divide hits by a floating point number self.per_page, convert its ceiling value to an integer and substitute it for self._num_pages.
self . _num_pages = int ( ceil ( hits / float ( self . per_page ) ) )