<commit_before><% he = HTMLEntities.new %>
<h1>Chat Log: <%= he.encode params[:buffer] %> on <%= he.encode params[:network] %></h1>
<p><a class='button orange' href='/<%= URI.encode params[:network] %>'>Back</a></p>
<%

  path = File.expand_path $opts[:log_dir]

  log = nil

  Dir.new(path).each do |file|
    my_path = "#{path}/#{file}"
    next unless File.file? my_path

    match = file.match $opts[:file_name_regex]

    next unless match and match[:network] == params[:network]
    next unless match[:buffer] == params[:buffer]

    log = my_path

    break
  end

  if log
    even = true
%>
<table style="table-layout: fixed; width: 95%;">
  <thead>
    <tr>
      <th></th>
      <th>Date</th>
      <th>Lines</th>
    </tr>
  </thead>
  <tbody>
    <%
      last_date = nil
      lines     = 0
      network   = URI.encode params[:network]
      buffer    = URI.encode params[:buffer]

      File.open(log, 'r') do |f|
        f.each_line do |line|
          line.fix_encoding!

          date = line.split.first
          last_date = date if last_date.nil?

          lines += 1

          unless date == last_date
        %>
        <tr>
          <td><a class='green button' href='/<%= network %>/<%=buffer %>/<%= URI.encode date %>'>View</a></td>
          <td><%= he.encode date %></td>
          <td><%= lines %></td>
        </tr>

        <%
          lines = 0
          last_date = date
          end
        end
      end
    %>
  </tbody>
</table>
<%
    else
    %>Not Found<%
    end

  %>
<commit_msg>views/buffer: include last date (oops)<commit_after><% he = HTMLEntities.new %>
<h1>Chat Log: <%= he.encode params[:buffer] %> on <%= he.encode params[:network] %></h1>
<p><a class='button orange' href='/<%= URI.encode params[:network] %>'>Back</a></p>
<%

  path = File.expand_path $opts[:log_dir]

  log = nil

  Dir.new(path).each do |file|
    my_path = "#{path}/#{file}"
    next unless File.file? my_path

    match = file.match $opts[:file_name_regex]

    next unless match and match[:network] == params[:network]
    next unless match[:buffer] == params[:buffer]

    log = my_path

    break
  end

  if log
    even = true
%>
<table style="table-layout: fixed; width: 95%;">
  <thead>
    <tr>
      <th></th>
      <th>Date</th>
      <th>Lines</th>
    </tr>
  </thead>
  <tbody>
    <%
      date      = nil
      last_date = nil
      lines     = 0
      network   = URI.encode params[:network]
      buffer    = URI.encode params[:buffer]

      File.open(log, 'r') do |f|
        f.each_line do |line|
          line.fix_encoding!

          date = line.split.first
          last_date = date if last_date.nil?

          lines += 1

          unless date == last_date
        %>
        <tr>
          <td><a class='green button' href='/<%= network %>/<%=buffer %>/<%= URI.encode date %>'>View</a></td>
          <td><%= he.encode date %></td>
          <td><%= lines %></td>
        </tr>
        <%
          lines = 0
          last_date = date
          end
        end
      end
    %>
    <tr>
      <td><a class='green button' href='/<%= network %>/<%=buffer %>/<%= URI.encode date %>'>View</a></td>
      <td><%= he.encode date %></td>
      <td><%= lines %></td>
    </tr>
    <%
    %>
  </tbody>
</table>
<%
    else
    %>Not Found<%
    end

  %>

{'fraction_non_alphanumeric': 0.18456883509833585, 'fraction_numerical': 0.004236006051437216, 'mean_word_length': 1.9783783783783784, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 107, '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': '6767481', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1135, 'n_words': 276}