Merge pull request #2199 from cryode/feature/pagination

Multiple pagination bug fixes & optimizations.