{"action":"closed","issue":{"url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3303","labels_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3303/labels{/name}","comments_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3303/comments","events_url":"https://api.github.com/repos/tomchristie/django-rest-framework/issues/3303/events","html_url":"https://github.com/tomchristie/django-rest-framework/issues/3303","id":102015668,"number":3303,"title":"pagination.LimitOffsetPagination.get_html_context  fails when count=0 and offset=0","user":{"login":"ugurunver","id":4191815,"avatar_url":"https://avatars.githubusercontent.com/u/4191815?v=3","gravatar_id":"","url":"https://api.github.com/users/ugurunver","html_url":"https://github.com/ugurunver","followers_url":"https://api.github.com/users/ugurunver/followers","following_url":"https://api.github.com/users/ugurunver/following{/other_user}","gists_url":"https://api.github.com/users/ugurunver/gists{/gist_id}","starred_url":"https://api.github.com/users/ugurunver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ugurunver/subscriptions","organizations_url":"https://api.github.com/users/ugurunver/orgs","repos_url":"https://api.github.com/users/ugurunver/repos","events_url":"https://api.github.com/users/ugurunver/events{/privacy}","received_events_url":"https://api.github.com/users/ugurunver/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-19T22:41:22Z","updated_at":"2015-08-20T09:12:58Z","closed_at":"2015-08-20T09:12:58Z","body":"For 3.2.2\r\n\r\nhttps://github.com/tomchristie/django-rest-framework/blob/1b53e804ee86e5611bb02ced499e1fcc08b6c5f9/rest_framework/pagination.py#L414\r\n\r\nIn LimitOffsetPagination.get_html_context method, when offset value is zero,  current is 1 (bacause _divide_with_ceil function always returns 0 when first param is 0)\r\n\r\n    current = _divide_with_ceil(self.offset, self.limit) + 1\r\n\r\nand when count is zero too (it means there is no object in our data, model etc.), \r\n\r\n    final = (\r\n\t            _divide_with_ceil(self.count - self.offset, self.limit) +\r\n\t            _divide_with_ceil(self.offset, self.limit)\r\n        )\r\n\r\nfinal computed as 0 (zero) because  'self.count - self.offset = self.offset = 0'\r\nAnd finally, \r\n\r\n    if current > final:\r\n        current = final\r\n\r\ncurrent = final = 0 .\r\nThen _get_displayed_page_numbers function raises assertion error on here:\r\nhttps://github.com/tomchristie/django-rest-framework/blob/1b53e804ee86e5611bb02ced499e1fcc08b6c5f9/rest_framework/pagination.py#L75\r\n\r\n    assert current >= 1\r\n    assert final >= current\r\n\r\n\r\nAm I doing wrong anything or is it just a bug?\r\n\r\n\r\n\r\n"}}