php - Cakephp retrieves pages over limit -
i'm using cakephp 1.3 paginator, works fine, except this:
if have 5 pages, accessing kind of url
i'll last page, if access to
i last page. want not retrieve values, since not valid page.
my configuration this:
  var $paginate = array(         'post' => array(             'limit' => 10,             'order' => array('post.id' => 'desc')                    )      );  $posts = $this->paginate('post');      
well, that's unfortunately how works until cakephp 2.3, , it's buried in middle of controller::paginate() method:
https://github.com/cakephp/cakephp/blob/1.3.20/cake/libs/controller/controller.php#l1214-l1215
// ...  if ($page === 'last' || $page >= $pagecount) {     $options['page'] = $page = $pagecount;  // ...   so pretty have 1 option, calculate page count , use validate current page.
Comments
Post a Comment