<commit_before><%
all_pages_count = (@all_threads_count / @limit).ceil
start_page = @page - 5
end_page = @page + 5

if start_page <= 0
  end_page += -start_page
  start_page = 1
end

end_page = all_pages_count if end_page > all_pages_count
%><div class="cf-pages">
  <ul>
    <li<% if @page == 0 %> class="disabled"<% end %>><%= link_to '«', cf_forum_path(current_forum || 'all') %></li>

    <% (start_page..end_page+1).each do |i| %>
    <li<% if i - 1 == @page %> class="active disabled"<% end %>><%= link_to i, cf_forum_path(current_forum || 'all', p: i-1) %></li>
    <% end %>

    <li<% if @page == all_pages_count %> class="disabled"<% end %>><%= link_to '»', cf_forum_path(current_forum || 'all', p: all_pages_count) %></li>
  </ul>
</div><commit_msg>fix: some bugs in paging<commit_after><%
all_pages_count = (@all_threads_count.to_f / @limit.to_f).ceil
start_page = @page - 5
end_page = @page + 5

if start_page <= 0
  end_page += -start_page
  start_page = 1
end

end_page = all_pages_count if end_page > all_pages_count
%><div class="cf-pages">
  <ul>
    <li<% if @page == 0 %> class="disabled"<% end %>><%= link_to '«', cf_forum_path(current_forum) %></li>

    <% (start_page..end_page).each do |i| %>
    <li<% if i - 1 == @page %> class="active disabled"<% end %>><%= link_to i, cf_forum_path(current_forum, p: i-1) %></li>
    <% end %>

    <li<% if @page == all_pages_count - 1 %> class="disabled"<% end %>><%= link_to '»', cf_forum_path(current_forum, p: all_pages_count - 1) %></li>
  </ul>
</div>
{'fraction_non_alphanumeric': 0.20921052631578949, 'fraction_numerical': 0.01118421052631579, 'mean_word_length': 4.121212121212121, 'pattern_counts': {'":': 0, '<': 49, '<?xml version=': 0, '>': 49, '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': '4423057', 'n_tokens_mistral': 657, 'n_tokens_neox': 588, 'n_words': 144}