correct calculation of paging
Merge pull request #2 from jwynveen/master

Correct calculation of paging