I use Propel to get result from MySQL and use paginate.
When for a result that have for example 100 rows and I use
->paginate(6, 20);
it must return NULL because we past the last page but it returns content of the last page even I use paginate(10000, 20)!!!!
In the other word how can I understand I passed the last page if I can not force it to return NULL for pages after last page?
Actually you can count the number of total elements by a simple count() function and then calculate how many page you have and what is your last page.
If you go inside of the php files of propel you would see that when the result is empty it feeds the last page as the result and returns it back.
I don't think that you have any other option.