<commit_before><% 
  content_for :page_title, t("#titles.error_reports", "Error Reports")
  add_crumb t("#crumbs.error_reports", "Error Reports")
%>

<% form_for @current_user, :url => '/error_reports', :html => { :method => :get }  do |f| %>
  <% if error_search_enabled? %>
    <%= t :message_contains, "Message contains" %>
    <input type="text" name="message" value="<%= @message %>" style="width: 250px;"/>
  <% end %>
  <select name="category">
    <%= options_for_select([[t(:all_categories, " - All Categories -"), nil]] + ErrorReport.categories, params[:category]) %>
  </select>
  <button type="submit" class="button"><%= t "#buttons.search", "Search" %></button>
<% end %>

<% content_for :pagination do %>
  <% if params[:action] == 'index' %>
    <%= will_paginate(@reports, :page_links => false) %>
  <% end %>
<% end %>

<%= yield :pagination %>

<% @reports.each do |report| %>
  <div style="margin-bottom: 20px;">
    <h3>
      <%= link_to "##{report.id}", error_url(report) %>
      <% if @reports.length > 1 %>
        <%= truncate(report.message, :length => 80) %>
      <% else %>
        <%= report.message %>
      <% end %>
    </h3>

    <div style="border: 1px solid #eee; -moz-border-radius: 5px; padding: 5px 20px;">
      <% if report.account_id %>
        <%= before_label :account, "account" %> <%= link_to report.account.try(:name), account_url(report.account_id) %><br />
      <% end %>
      <%= before_label :category, "category" %> <%= report.category || t(:default_category, 'default') %><br/>
      <%= before_label :created_at, "created at" %> <%= report.created_at %><br />
      <% if report.user_id %>
        <%= before_label :user, "user" %> <%= link_to report.user.try(:name), user_url(report.user_id) %><br />
      <% end %>
      <%= before_label :url, "url" %> <%= report.url %><br/>
      <% if report.request_context_id %>
        <%= before_label :request_context_id, "request context id" %> <%= report.request_context_id %>
      <% end %>
      <% if report.comments %>
        <%= before_label :comments, "comments" %> <%= report.comments %><br/>
      <% end %>
      <% (report.data || {}).to_a.sort.each do |k,v| %>
        <% next if k.to_s == "exception_message" %>
        <br><%= before_label k.to_s %> <%= v %>
      <% end %>
      <br />
      <pre style="font-size: 0.8em; margin-left: 20px; <%= "max-height: 150px;" if @reports.length > 1 %> overflow: auto;">
        <%= report.data.try(:[], "exception_message") %><br />
        <%= report.backtrace %>
      </pre><commit_msg>linkify error report urls<commit_after><% 
  content_for :page_title, t("#titles.error_reports", "Error Reports")
  add_crumb t("#crumbs.error_reports", "Error Reports")
%>

<% form_for @current_user, :url => '/error_reports', :html => { :method => :get }  do |f| %>
  <% if error_search_enabled? %>
    <%= t :message_contains, "Message contains" %>
    <input type="text" name="message" value="<%= @message %>" style="width: 250px;"/>
  <% end %>
  <select name="category">
    <%= options_for_select([[t(:all_categories, " - All Categories -"), nil]] + ErrorReport.categories, params[:category]) %>
  </select>
  <button type="submit" class="button"><%= t "#buttons.search", "Search" %></button>
<% end %>

<% content_for :pagination do %>
  <% if params[:action] == 'index' %>
    <%= will_paginate(@reports, :page_links => false) %>
  <% end %>
<% end %>

<%= yield :pagination %>

<% @reports.each do |report| %>
  <div style="margin-bottom: 20px;">
    <h3>
      <%= link_to "##{report.id}", error_url(report) %>
      <% if @reports.length > 1 %>
        <%= truncate(report.message, :length => 80) %>
      <% else %>
        <%= report.message %>
      <% end %>
    </h3>

    <div style="border: 1px solid #eee; -moz-border-radius: 5px; padding: 5px 20px;">
      <% if report.account_id %>
        <%= before_label :account, "account" %> <%= link_to report.account.try(:name), account_url(report.account_id) %><br />
      <% end %>
      <%= before_label :category, "category" %> <%= report.category || t(:default_category, 'default') %><br/>
      <%= before_label :created_at, "created at" %> <%= report.created_at %><br />
      <% if report.user_id %>
        <%= before_label :user, "user" %> <%= link_to report.user.try(:name), user_url(report.user_id) %><br />
      <% end %>
      <% if report.url.present? %>
        <%= before_label :url, "url" %> <%= link_to report.url, report.url %><br/>
      <% end %>
      <% if report.request_context_id %>
        <%= before_label :request_context_id, "request context id" %> <%= report.request_context_id %>
      <% end %>
      <% if report.comments %>
        <%= before_label :comments, "comments" %> <%= report.comments %><br/>
      <% end %>
      <% (report.data || {}).to_a.sort.each do |k,v| %>
        <% next if k.to_s == "exception_message" %>
        <br><%= before_label k.to_s %> <%= v %>
      <% end %>
      <br />
      <pre style="font-size: 0.8em; margin-left: 20px; <%= "max-height: 150px;" if @reports.length > 1 %> overflow: auto;">
        <%= report.data.try(:[], "exception_message") %><br />
        <%= report.backtrace %>
      </pre>
{'fraction_non_alphanumeric': 0.21937102064441444, 'fraction_numerical': 0.008875168821146055, 'mean_word_length': 3.1806451612903226, 'pattern_counts': {'":': 0, '<': 149, '<?xml version=': 0, '>': 163, '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': '5876389', 'n_tokens_mistral': 1990, 'n_tokens_neox': 1717, 'n_words': 365}