Seperated _encode_cursor and _paginate functions