

def get_shown_pages(self, page_index_count=11):
    if (not self.has_more_pages):
        return range(1, 2)
    min_page = 1
    max_page = int(ceil((float(self.num_items) / self.max_per_page)))
    current_page = (self.page + 1)
    start_page = (current_page - (page_index_count / 2))
    end_page = ((current_page + (page_index_count / 2)) + ((page_index_count % 2) - 1))
    if (start_page < min_page):
        start_page = min_page
    if (end_page > max_page):
        end_page = max_page
    return range(start_page, (end_page + 1))

dataset/ETHPy150Open edgewall/trac/trac/util/presentation.py Paginator.get_shown_pages/original