<commit_before><%= error_messages_for 'censor_rule' %>

<div class="well">
  <%=_("Applies to")%>
  <% unless info_request.nil? %>
    <%= request_link(info_request)%>
    <%= request_admin_link(info_request, "(admin)", "btn btn-info")%>
    <%= hidden_field 'censor_rule', 'info_request_id', { :value => info_request.id } %>
  <% end %>
  <% unless user.nil? %>
    <%= user_link(user) %>
    <%= user_admin_link(user, "admin", "btn btn-info") %>
    <%= hidden_field 'censor_rule', 'user_id', { :value => user.id } %>
<% end %>
</div>

<div class="control-group">
  <label for="censor_rule_regexp" class="control-label">Is it regexp replacement?</label>
  <div class="controls">
    <%= check_box 'censor_rule', 'regexp' %>
    <div class="help-block">
      Leave unchecked if you are not sure about this
    </div>
  </div>
</div>

<div class="control-group">
  <label for="censor_rule_text" class="control-label">Text</label>
  <div class="controls">
    <%= text_field 'censor_rule', 'text', :class => "span3" %>
    <div class="help-block">
      that you want to remove, case sensitive
    </div>
  </div>
</div>

<div class="control-group">
  <label for="censor_rule_replacement" class="control-label">Replacement</label>
  <div class="controls">
    <%= text_field 'censor_rule', 'replacement', :class => "span3"  %>
    <div class="help-block">
      put it in <strong>[square brackets]</strong>, e.g. [personal information removed]. applies to text in emails and HTML conversions of binaries; binaries themselves must stay the same length and the replacement is just a bunch of 'x's
    </div>
  </div>
</div>

<div class="control-group">
  <label for="censor_rule_last_edit_comment" class="control-label">Comment for this edit</label>
  <div class="controls">
    <%= text_area 'censor_rule', 'last_edit_comment', :rows => 2, :class => "span6"  %>
    <div class="help-block">
      put purpose of the rule, and why the change
    </div>
  </div>
</div>

<div class="row">
  <div class="span10 offset2">
    <div class="alert alert-info">
      <h3>Warning and notes:</h3>
      <p> This does replace text in binary files, but for
      most formats only in a naive way. It works well on surprisingly many Word documents. Notably
      it doesn't even do UCS-2 (unicode sometimes used in Word). There is also special code
      which works on some PDFs. Please <strong>carefully check</strong> all attachments have
      changed in the way you expect, and haven't become corrupted.
      </p>
      <p>You may need to manually rebuild the search index afterwards. You can redact
      things by individual request or by user by adding the censor rule from the
      appropriate page.  If you need to redact across a whole
      authority, it will be easy enough to make code changes to add it, so do ask.
      </p>
    </div>
  </div>
</div><commit_msg>Add warning about regex censor rules.<commit_after><%= error_messages_for 'censor_rule' %>

<div class="well">
  <%=_("Applies to")%>
  <% unless info_request.nil? %>
    <%= request_link(info_request)%>
    <%= request_admin_link(info_request, "(admin)", "btn btn-info")%>
    <%= hidden_field 'censor_rule', 'info_request_id', { :value => info_request.id } %>
  <% end %>
  <% unless user.nil? %>
    <%= user_link(user) %>
    <%= user_admin_link(user, "admin", "btn btn-info") %>
    <%= hidden_field 'censor_rule', 'user_id', { :value => user.id } %>
<% end %>
</div>

<div class="control-group">
  <label for="censor_rule_regexp" class="control-label">Is it regexp replacement?</label>
  <div class="controls">
    <%= check_box 'censor_rule', 'regexp' %>
    <div class="help-block">
      Leave unchecked if you are not sure about this
    </div>
  </div>
</div>

<div class="control-group">
  <label for="censor_rule_text" class="control-label">Text</label>
  <div class="controls">
    <%= text_field 'censor_rule', 'text', :class => "span3" %>
    <div class="help-block">
      that you want to remove, case sensitive
    </div>
  </div>
</div>

<div class="control-group">
  <label for="censor_rule_replacement" class="control-label">Replacement</label>
  <div class="controls">
    <%= text_field 'censor_rule', 'replacement', :class => "span3"  %>
    <div class="help-block">
      put it in <strong>[square brackets]</strong>, e.g. [personal information removed]. applies to text in emails and HTML conversions of binaries; binaries themselves must stay the same length and the replacement is just a bunch of 'x's
    </div>
  </div>
</div>

<div class="control-group">
  <label for="censor_rule_last_edit_comment" class="control-label">Comment for this edit</label>
  <div class="controls">
    <%= text_area 'censor_rule', 'last_edit_comment', :rows => 2, :class => "span6"  %>
    <div class="help-block">
      put purpose of the rule, and why the change
    </div>
  </div>
</div>

<div class="row">
  <div class="span10 offset2">
    <div class="alert alert-info">
      <h3>Warning and notes:</h3>
      <p> This does replace text in binary files, but for
      most formats only in a naive way. It works well on surprisingly many Word documents. Notably
      it doesn't even do UCS-2 (unicode sometimes used in Word). There is also special code
      which works on some PDFs. Please <strong>carefully check</strong> all attachments have
      changed in the way you expect, and haven't become corrupted.
      </p>
      <p>You may need to manually rebuild the search index afterwards. You can redact
      things by individual request or by user by adding the censor rule from the
      appropriate page.  If you need to redact across a whole
      authority, it will be easy enough to make code changes to add it, so do ask.
      </p>
      <p>
         <strong>Regexp rules that are hard to process will really slow down request display.</strong> Please only use regexps if you really need to.
      </p>
    </div>
  </div>
</div>
{'fraction_non_alphanumeric': 0.14420644290774162, 'fraction_numerical': 0.0033732501264968798, 'mean_word_length': 3.6328125, 'pattern_counts': {'":': 0, '<': 139, '<?xml version=': 0, '>': 151, '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': '1353803', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1858, 'n_words': 626}