We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Paginator's "next" can't link to the last page

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

For example:

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..



1.7k
Accepted
answer

Okay, it's a bug

and will be fixed in 1.3.3