added pagination
refactor paginateCursor
added tests for pagination
fix for page 0
fix pagination, invalid page, not including 0