Handling pagination.