Django Paginator returns results of the last page despite page number being greater than the last feasible page

Lets say I have 92 objects and want them to paginate by 5 per page. That's 19 pages where the last page contains 2 objects. Why doesn't it raise EmptyPage or InvalidPage exception if page is greater than 19?

page = int(request.GET.get('page'))
paginator = Paginator(self.get_queryset(), self.paginate_by, allow_empty_first_page=False)

    page = paginator.get_page(page)
    reports = list(page.object_list)
except (EmptyPage, InvalidPage) as _error:
    reports = []
Back to Top