Fix pagination() to get the right total number of pages
Merge pull request #561 from eryx/master

Fix pagination() to get the right total number of pages