<commit_before><h1>Topics</h1>

<%= link_to new_topic_path, :class => "btn btn-primary" do %>
  New Topic
<% end %>
  <%= link_to topics_path do %>
      <span class="badge">All</span>
  <% end %>

  <% @categories.each do |cat| %>
    <%= link_to topics_path( :cate => cat.id ) do %>
      <span class="badge"><%= cat.name %></span>
    <% end %>
  <% end %>

  <%= link_to topics_path( :cate => 0) do %>
      <span class="badge">Uncategoried</span>
  <% end %>

<div>

</div>

<table class="table table-striped table-bordered">
  <tr>
    <td></td>
    <td>Topic</td>
    <td>Category</td>
    <td>Author</td>
    <!-- <td>Replies</td> -->
    <td><%= link_to "Replies", topics_path( merge_topic_filters(params, :sort => "comments_count", :order => "desc") ) %></td>
    <td><%= link_to "Views", topics_path( merge_topic_filters(params, :sort => "views", :order => "desc") ) %></td>
    <td><%= link_to "Updated", topics_path( merge_topic_filters(params, :sort => "updated_at", :order => "desc") ) %></td>
  </tr>

  <% @topics.each do |t| %>
    <tr>
      <td><%= t.id %></td>
      <td><%= link_to t.title, topic_path(t) %></td>
      <td>
        <% t.categories.each do |cat| %>
          <%= link_to topics_path( :cate => cat.id ) do %>
            <span class="badge"><%= cat.name %></span>
          <% end %>
        <% end %>
      </td>
      <td><%= link_to t.user.username, user_path(t.user.id) %></td>
      <td><%= t.comments.size %></td>
      <td><%= t.views %></td>
      <td><%= t.updated_at.to_s(:short) %></td>
    </tr>
  <% end %>
</table>

<%= paginate @topics %><commit_msg>show category filter on index;<commit_after><h1>Topics</h1>
<% if @category %>
  <h3><%= @category %></h3>
<% end %>

<%= link_to new_topic_path, :class => "btn btn-primary" do %>
  New Topic
<% end %>
  <%= link_to topics_path do %>
      <span class="badge">All</span>
  <% end %>

  <% @categories.each do |cat| %>
    <%= link_to topics_path( :cate => cat.id ) do %>
      <span class="badge"><%= cat.name %></span>
    <% end %>
  <% end %>

  <%= link_to topics_path( :cate => 0) do %>
      <span class="badge">Uncategoried</span>
  <% end %>

<div>

</div>

<table class="table table-striped table-bordered">
  <tr>
    <td></td>
    <td>Topic</td>
    <td>Category</td>
    <td>Author</td>
    <td><%= link_to "Replies", topics_path( merge_topic_filters(params, :sort => "comments_count", :order => "desc") ) %></td>
    <td><%= link_to "Views", topics_path( merge_topic_filters(params, :sort => "views", :order => "desc") ) %></td>
    <td><%= link_to "Updated", topics_path( merge_topic_filters(params, :sort => "updated_at", :order => "desc") ) %></td>
  </tr>

  <% @topics.each do |t| %>
    <tr>
      <td><%= t.id %></td>
      <td><%= link_to t.title, topic_path(t) %></td>
      <td>
        <% t.categories.each do |cat| %>
          <%= link_to topics_path( :cate => cat.id ) do %>
            <span class="badge"><%= cat.name %></span>
          <% end %>
        <% end %>
      </td>
      <td><%= link_to t.user.username, user_path(t.user.id) %></td>
      <td><%= t.comments.size %></td>
      <td><%= t.views %></td>
      <td><%= t.updated_at.to_s(:short) %></td>
    </tr>
  <% end %>
</table>

<%= paginate @topics %>
{'fraction_non_alphanumeric': 0.2441502463054187, 'fraction_numerical': 0.0024630541871921183, 'mean_word_length': 2.8404255319148937, 'pattern_counts': {'":': 0, '<': 159, '<?xml version=': 0, '>': 179, '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': '4204220', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1257, 'n_words': 265}