Devtools' scaffold generated this code for me:
$paginator = new Paginator(array( "data" => $products, "limit"=> 10, "page" => $numberPage )); $this->view->page = $paginator->getPaginate();
But I found that the
$page->next can't link to the last page
assume that the total_pages is 5
then when I'm in page 4, the
$page->next will print 4, not 5
I did more tests with 5 items, when
limit = 1 : wrong
limit = 2 : wrong
limit = 3 : Correct
limit = 4 : wrong
so... when your last page has only 1 item left, the next page can't link appropriately..
I think it's a bug
or did I do something wrong?? The code is devtool generated for me..