Update pagination.php

Fix potential pagination issues
Merge pull request #17 from JMSolo/patch-1

Update pagination.php