Returns the total number of pages.

def num_pages(self):
        """
        Returns the total number of pages.
        """

        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)))