<commit_before><div class="search-wide">
  <%= form_tag(notifications_path, :method => "get", :class => "form form-horizontal", :role => "form") do %>
    <div class="input-group">
      <%= search_field_tag :q, params[:q], :placeholder => "Search", :class => "form-control" %>
      <div class="input-group-btn">
        <button type="submit" class="btn btn-primary hidden-xs"><%= icon("search") %></button>
      </div>
    </div>
  <% end %>
</div>

<div class="row">
  <div class='col-md-9'>
    <% if @notification_count > 0 %>
      <% if @notification_count > 1 %>
        <h4 class="results"><%= number_with_delimiter(@notification_count) %> Notifications</h4>
      <% end %>
      <% @notifications.each do |notification| %>
        <div class="panel panel-default">
          <div class="panel-heading panel-title panel-list">
            <% if notification.level != 3 %><span class="pull-right"><%= level_label(notification.level).html_safe %></span><% end %>
            <%= link_to ((notification.status.blank? ? "" : "[#{notification.status}] ") + h(notification.message)).html_safe, "#notification_#{notification.uuid}", :class => "accordion-toggle", :id => "notification_#{notification.uuid}-link", :data => { :toggle => "collapse", :parent => "#notification" }, :href => "#notification_#{notification.uuid}" %>
          </div>
          <div class="panel-collapse collapse" id="notification_<%= notification.uuid %>">
            <div class="panel-body notification-inner">
              <% if can?(:destroy, Notification) %>
                <div class="btn-group btn-group-sm pull-right">
                  <a class="btn btn-default dropdown-toggle" id="notification_<%= notification.uuid %>-delete" data-toggle="dropdown" href="#">
                    <%= icon("trash") %> <span class="caret"></span>
                  </a>
                  <ul class="dropdown-menu">
                    <li><%= link_to "by Message", notification_path(notification, q: params[:q],
                                                                    source_id: params[:source_id],
                                                                    level: params[:level],
                                                                    class_name: params[:class_name],
                                                                    hostname: params[:hostname],
                                                                    page: params[:page]),
                                                                    method: :delete,
                                                                    data: { :confirm => 'Are you sure?' },
                                                                    remote: true,
                                                                    id: "notification_#{notification.uuid}-delete-message" %></li>
                    <li><%= link_to "by Class", notification_path(notification, q: params[:q],
                                                                  source_id: params[:source_id],
                                                                  level: params[:level],
                                                                  class_name: params[:class_name],
                                                                  hostname: params[:hostname],
                                                                  filter: "class_name",
                                                                  page: params[:page]),
                                                                  method: :delete,
                                                                  data: { :confirm => 'Are you sure?' },
                                                                  remote: true,
                                                                  id: "notification_#{notification.uuid}-delete-class" %></li>
                    <% unless notification.source_id.nil? %>
                      <li><%= link_to "by Source", notification_path(notification, q: params[:q],
                                                                     source_id: params[:source_id],
                                                                     level: params[:level],
                                                                     class_name: params[:class_name],
                                                                     hostname: params[:hostname],
                                                                     filter: "source",
                                                                     page: params[:page]),
                                                                     method: :delete,
                                                                     data: { :confirm => 'Are you sure?' },
                                                                     remote: true,
                                                                     id: "notification_#{notification.uuid}-delete-source" %></li>
                    <% end %>
                  </ul>
                </div>
              <% end %>
              <p class="class-name"><%= link_to notification.class_name, notifications_path(class_name: h(notification.class_name),
                                                                              source_id: params[:source_id],
                                                                              level: params[:level],
                                                                              hostname: params[:hostname],
                                                                              q: params[:q]) %></p>
              <% if notification.source %>
                <h5>Source</h5>
                <%= link_to notification.source.title, source_path(notification.source) %>
              <% end %>

              <% if notification.work %>
                <h5>Work</h5>
                <%= link_to notification.work.pid, work_path(notification.work) %>
              <% end %>

              <h5>Time</h5>
              <%= notification.created_at.to_s(:friendly) %>

              <% unless notification.hostname.blank? %>
                <h5>Hostname</h5>
                <%= notification.hostname %>
              <% end %>

              <% unless notification.content_type.blank? or notification.content_type == "text/html" %>
                <h5>Content Type</h5>
                <%= notification.content_type %>
              <% end %>

              <% unless notification.target_url.blank? %>
                <h5>Target URL</h5>
                <%= link_to notification.target_url, notification.target_url %>
              <% end %>

              <% if ["Net::HTTPUnauthorized","ActionDispatch::RemoteIp::IpSpoofAttackError"].include? notification.class_name %>
                <% unless notification.remote_ip.blank? %>
                  <h5>Remote IP</h5>
                  <%= link_to notification.remote_ip, notification.remote_ip %>
                <% end %>

                <% unless notification.user_agent.blank? %>
                  <h5>User Agent</h5>
                  <%= notification.user_agent %>
                <% end %>
              <% end %>

              <% unless notification.details.blank? %>
                <h5>Details</h5>
                <%= notification.details %>
              <% end %>

              <% unless notification.trace.blank? %>
                <h5>Trace</h5>
                <%= simple_format(notification.trace) %>
              <% end %>
            </div>
          </div>
        </div>
      <% end %>
      <div class="text-center">
        <%= will_paginate @notifications, :params => { :controller => notifications_path }, :renderer => BootstrapPagination::Rails %>
      </div>
    <% else %>
      <div class="alert alert-info">There are currently no <% unless @class_name.nil? %><%= h(@class_name) %> <% end %>notifications
        <% unless @source.nil? %>
          for <%= @source.title %>
        <% end %>
        <% unless @level.nil? %>
          with at least level <em><%= Notification::LEVELS[@level] %></em>
        <% end %>
        <% unless params[:q].blank? %>
          with <em><%= params[:q] %></em> in the class name, message or PID
        <% end %>
      </div>
    <% end %>
  </div>
  <div class='col-md-3'>
    <% if @hostname || @hostnames.size > 1 %>
      <div class="panel facets">
        <div class="panel-body">
          <h4>Servers</h4>
          <ul>
            <% if @hostname.present? %>
              <li class="active">
                <%= link_to icon('check-square-o').html_safe, notifications_path(class_name: params[:class_name], level: params[:level], q: params[:q]) %>
                <%= @hostname.first %>
                <span class="number pull-right"><%= number_with_delimiter(@hostname.last) %></span>
              </li>
            <% else %>
              <% @hostnames.each do |hostname| %>
                <li>
                  <%= link_to icon('square-o').html_safe, notifications_path(source_id: params[:source_id], class_name: params[:class_name], level: params[:level], hostname: hostname.first, q: params[:q]) %>
                  <%= hostname.first %>
                  <span class="number pull-right"><%= number_with_delimiter(hostname.last) %></span>
                </li>
              <% end %>
            <% end %>
          </ul>
        </div>
      </div>
    <% end %>
    <% if @level || @levels.length > 0 %>
      <div class="panel facets">
        <div class="panel-body">
          <h4>Levels</h4>
          <ul>
            <% if @level.present? %>
              <li class="active">
                <%= link_to icon('check-square-o').html_safe, notifications_path(class_name: params[:class_name], source_id: params[:source_id], hostname: params[:hostname], q: params[:q]) %>
                <%= Notification::LEVELS[@level.first].humanize %>
                <span class="number pull-right"><%= number_with_delimiter(@level.last) %></span>
              </li>
            <% else %>
              <% @levels.each do |level| %>
                <li>
                  <%= link_to icon('square-o').html_safe, notifications_path(level: Notification::LEVELS[level.first].downcase, class_name: params[:class_name], source_id: params[:source_id], hostname: params[:hostname], q: params[:q]) %>
                  <%= Notification::LEVELS[level.first].humanize %>
                  <span class="number pull-right"><%= number_with_delimiter(level.last) %></span>
                </li>
              <% end %>
            <% end %>
          </ul>
        </div>
      </div>
    <% end %>
    <% if @source || @sources.size > 0 %>
      <div class="panel facets">
        <div class="panel-body">
          <h4>Sources</h4>
          <ul>
            <% if @source_group.present? %>
             <% s = Source.where(id: @source_group.first).first %>
              <li class="active">
                <%= link_to icon('check-square-o').html_safe, notifications_path(level: params[:level], class_name: params[:class_name], hostname: params[:hostname], q: params[:q]) %>
                <%= s.title %>
                <span class="number pull-right"><%= number_with_delimiter(@source_group.last) %></span>
              </li>
            <% else %>
              <% @sources.each do |source| %>
                <% s = Source.where(id: source.first).first %>
                <li>
                  <%= link_to icon('square-o').html_safe, notifications_path(level: params[:level], class_name: params[:class_name], source_id: s.name, hostname: params[:hostname], q: params[:q]) %>
                  <%= s.title %>
                  <span class="number pull-right"><%= number_with_delimiter(source.last) %></span>
                </li>
              <% end %>
            <% end %>
          </ul>
        </div><commit_msg>show source in notifications if selected<commit_after><div class="search-wide">
  <%= form_tag(notifications_path, :method => "get", :class => "form form-horizontal", :role => "form") do %>
    <div class="input-group">
      <%= search_field_tag :q, params[:q], :placeholder => "Search", :class => "form-control" %>
      <div class="input-group-btn">
        <button type="submit" class="btn btn-primary hidden-xs"><%= icon("search") %></button>
      </div>
    </div>
  <% end %>
</div>

<div class="row">
  <div class='col-md-9'>
    <% if @notification_count > 0 %>
      <% if @notification_count > 1 %>
        <h4 class="results"><%= number_with_delimiter(@notification_count) %> Notifications</h4>
      <% end %>
      <% @notifications.each do |notification| %>
        <div class="panel panel-default">
          <div class="panel-heading panel-title panel-list">
            <% if notification.level != 3 %><span class="pull-right"><%= level_label(notification.level).html_safe %></span><% end %>
            <%= link_to ((notification.status.blank? ? "" : "[#{notification.status}] ") + h(notification.message)).html_safe, "#notification_#{notification.uuid}", :class => "accordion-toggle", :id => "notification_#{notification.uuid}-link", :data => { :toggle => "collapse", :parent => "#notification" }, :href => "#notification_#{notification.uuid}" %>
          </div>
          <div class="panel-collapse collapse" id="notification_<%= notification.uuid %>">
            <div class="panel-body notification-inner">
              <% if can?(:destroy, Notification) %>
                <div class="btn-group btn-group-sm pull-right">
                  <a class="btn btn-default dropdown-toggle" id="notification_<%= notification.uuid %>-delete" data-toggle="dropdown" href="#">
                    <%= icon("trash") %> <span class="caret"></span>
                  </a>
                  <ul class="dropdown-menu">
                    <li><%= link_to "by Message", notification_path(notification, q: params[:q],
                                                                    source_id: params[:source_id],
                                                                    level: params[:level],
                                                                    class_name: params[:class_name],
                                                                    hostname: params[:hostname],
                                                                    page: params[:page]),
                                                                    method: :delete,
                                                                    data: { :confirm => 'Are you sure?' },
                                                                    remote: true,
                                                                    id: "notification_#{notification.uuid}-delete-message" %></li>
                    <li><%= link_to "by Class", notification_path(notification, q: params[:q],
                                                                  source_id: params[:source_id],
                                                                  level: params[:level],
                                                                  class_name: params[:class_name],
                                                                  hostname: params[:hostname],
                                                                  filter: "class_name",
                                                                  page: params[:page]),
                                                                  method: :delete,
                                                                  data: { :confirm => 'Are you sure?' },
                                                                  remote: true,
                                                                  id: "notification_#{notification.uuid}-delete-class" %></li>
                    <% unless notification.source_id.nil? %>
                      <li><%= link_to "by Source", notification_path(notification, q: params[:q],
                                                                     source_id: params[:source_id],
                                                                     level: params[:level],
                                                                     class_name: params[:class_name],
                                                                     hostname: params[:hostname],
                                                                     filter: "source",
                                                                     page: params[:page]),
                                                                     method: :delete,
                                                                     data: { :confirm => 'Are you sure?' },
                                                                     remote: true,
                                                                     id: "notification_#{notification.uuid}-delete-source" %></li>
                    <% end %>
                  </ul>
                </div>
              <% end %>
              <p class="class-name"><%= link_to notification.class_name, notifications_path(class_name: h(notification.class_name),
                                                                              source_id: params[:source_id],
                                                                              level: params[:level],
                                                                              hostname: params[:hostname],
                                                                              q: params[:q]) %></p>
              <% if notification.source %>
                <h5>Source</h5>
                <%= link_to notification.source.title, source_path(notification.source) %>
              <% end %>

              <% if notification.work %>
                <h5>Work</h5>
                <%= link_to notification.work.pid, work_path(notification.work) %>
              <% end %>

              <h5>Time</h5>
              <%= notification.created_at.to_s(:friendly) %>

              <% unless notification.hostname.blank? %>
                <h5>Hostname</h5>
                <%= notification.hostname %>
              <% end %>

              <% unless notification.content_type.blank? or notification.content_type == "text/html" %>
                <h5>Content Type</h5>
                <%= notification.content_type %>
              <% end %>

              <% unless notification.target_url.blank? %>
                <h5>Target URL</h5>
                <%= link_to notification.target_url, notification.target_url %>
              <% end %>

              <% if ["Net::HTTPUnauthorized","ActionDispatch::RemoteIp::IpSpoofAttackError"].include? notification.class_name %>
                <% unless notification.remote_ip.blank? %>
                  <h5>Remote IP</h5>
                  <%= link_to notification.remote_ip, notification.remote_ip %>
                <% end %>

                <% unless notification.user_agent.blank? %>
                  <h5>User Agent</h5>
                  <%= notification.user_agent %>
                <% end %>
              <% end %>

              <% unless notification.details.blank? %>
                <h5>Details</h5>
                <%= notification.details %>
              <% end %>

              <% unless notification.trace.blank? %>
                <h5>Trace</h5>
                <%= simple_format(notification.trace) %>
              <% end %>
            </div>
          </div>
        </div>
      <% end %>
      <div class="text-center">
        <%= will_paginate @notifications, :params => { :controller => notifications_path }, :renderer => BootstrapPagination::Rails %>
      </div>
    <% else %>
      <div class="alert alert-info">There are currently no <% unless @class_name.nil? %><%= h(@class_name) %> <% end %>notifications
        <% unless @source.nil? %>
          for <%= @source.title %>
        <% end %>
        <% unless @level.nil? %>
          with at least level <em><%= Notification::LEVELS[@level] %></em>
        <% end %>
        <% unless params[:q].blank? %>
          with <em><%= params[:q] %></em> in the class name, message or PID
        <% end %>
      </div>
    <% end %>
  </div>
  <div class='col-md-3'>
    <% if @hostname || @hostnames.size > 1 %>
      <div class="panel facets">
        <div class="panel-body">
          <h4>Servers</h4>
          <ul>
            <% if @hostname.present? %>
              <li class="active">
                <%= link_to icon('check-square-o').html_safe, notifications_path(class_name: params[:class_name], level: params[:level], q: params[:q]) %>
                <%= @hostname.first %>
                <span class="number pull-right"><%= number_with_delimiter(@hostname.last) %></span>
              </li>
            <% else %>
              <% @hostnames.each do |hostname| %>
                <li>
                  <%= link_to icon('square-o').html_safe, notifications_path(source_id: params[:source_id], class_name: params[:class_name], level: params[:level], hostname: hostname.first, q: params[:q]) %>
                  <%= hostname.first %>
                  <span class="number pull-right"><%= number_with_delimiter(hostname.last) %></span>
                </li>
              <% end %>
            <% end %>
          </ul>
        </div>
      </div>
    <% end %>
    <% if @level || @levels.length > 0 %>
      <div class="panel facets">
        <div class="panel-body">
          <h4>Levels</h4>
          <ul>
            <% if @level.present? %>
              <li class="active">
                <%= link_to icon('check-square-o').html_safe, notifications_path(class_name: params[:class_name], source_id: params[:source_id], hostname: params[:hostname], q: params[:q]) %>
                <%= Notification::LEVELS[@level.first].humanize %>
                <span class="number pull-right"><%= number_with_delimiter(@level.last) %></span>
              </li>
            <% else %>
              <% @levels.each do |level| %>
                <li>
                  <%= link_to icon('square-o').html_safe, notifications_path(level: Notification::LEVELS[level.first].downcase, class_name: params[:class_name], source_id: params[:source_id], hostname: params[:hostname], q: params[:q]) %>
                  <%= Notification::LEVELS[level.first].humanize %>
                  <span class="number pull-right"><%= number_with_delimiter(level.last) %></span>
                </li>
              <% end %>
            <% end %>
          </ul>
        </div>
      </div>
    <% end %>
    <% if @source_group || @sources.size > 0 %>
      <div class="panel facets">
        <div class="panel-body">
          <h4>Sources</h4>
          <ul>
            <% if @source_group.present? %>
             <% s = Source.where(id: @source_group.first).first %>
              <li class="active">
                <%= link_to icon('check-square-o').html_safe, notifications_path(level: params[:level], class_name: params[:class_name], hostname: params[:hostname], q: params[:q]) %>
                <%= s.title %>
                <span class="number pull-right"><%= number_with_delimiter(@source_group.last) %></span>
              </li>
            <% else %>
              <% @sources.each do |source| %>
                <% s = Source.where(id: source.first).first %>
                <li>
                  <%= link_to icon('square-o').html_safe, notifications_path(level: params[:level], class_name: params[:class_name], source_id: s.name, hostname: params[:hostname], q: params[:q]) %>
                  <%= s.title %>
                  <span class="number pull-right"><%= number_with_delimiter(source.last) %></span>
                </li>
              <% end %>
            <% end %>
          </ul>
        </div>
{'fraction_non_alphanumeric': 0.14185997910135842, 'fraction_numerical': 0.0030094043887147334, 'mean_word_length': 1.23774784885896, 'pattern_counts': {'":': 0, '<': 453, '<?xml version=': 0, '>': 497, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 164, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5310772', 'n_tokens_mistral': 5980, 'n_tokens_neox': 5430, 'n_words': 1082}