'Return the total number of pages.'

@cached_property
def num_pages(self):

    if ((self.count == 0) and (not self.allow_empty_first_page)):
        return 0
    hits = max(1, (self.count - self.orphans))
    return int(ceil((hits / float(self.per_page))))
