<commit_before>from django import template

register = template.Library()

def paginatorizer(context, adjacent_pages=5):
    page_obj = context['page_obj']
    current_page = int(context.get('page', 1))
    num_pages = page_obj.paginator.num_pages
    start_page = max(current_page - adjacent_pages, 2)
    end_page = min(current_page + adjacent_pages + 1, num_pages)
    page_numbers = range(start_page, end_page)
    context['page_numbers'] = page_numbers
    if len(page_numbers) > (adjacent_pages - 1):
        if page_numbers[0] > 2:
            context['show_begin_dots'] = True
        if page_numbers[-1] < num_pages-1:
            context['show_end_dots'] = True
        if len(page_numbers) > 1:
            context['show_end'] = True
    return context

register.inclusion_tag('paginator.html', takes_context=True)(paginatorizer)<commit_msg>fix the paginator<commit_after>from django import template

register = template.Library()

def paginatorizer(context, adjacent_pages=5):
    page = context['page_obj']
    num_pages = page.paginator.num_pages
    start_page = max(page.number - adjacent_pages, 2)
    end_page = min(page.number + adjacent_pages + 1, num_pages)
    page_numbers = range(start_page, end_page)
    context['page_numbers'] = page_numbers
    if len(page_numbers) > (adjacent_pages - 1):
        if page_numbers[0] > 2:
            context['show_begin_dots'] = True
        if page_numbers[-1] < num_pages-1:
            context['show_end_dots'] = True
        if len(page_numbers) > 1:
            context['show_end'] = True
    return context

register.inclusion_tag('paginator.html', takes_context=True)(paginatorizer)
{'fraction_non_alphanumeric': 0.1108419139915203, 'fraction_numerical': 0.01150817686250757, 'mean_word_length': 3.640449438202247, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5979351', 'n_tokens_mistral': 543, 'n_tokens_neox': 516, 'n_words': 104}