<commit_before># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
#

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  Mime::Type.register "image/jpeg", :jpg

  include ChecksAuthentication
  before_filter :check_authentication
  rescue_from( AuthFailure ) { |e| handle_authentication_failure(e) }

  # Scrub sensitive parameters from your log
  # filter_parameter_logging :password

  rescue_from( ErrorResponse ) { |e| render_error_response(e) }
 
  def render_error_response(ex)
    @exception = ex
 
    # Only add the error page to the status code if the request-format was HTML
    respond_to do |format|
      format.html do
        render( 
          :template => "shared/status_#{ex.status_code.to_s}",<commit_msg>Enable filter of password in log file (cherry picked from commit <PASSWORD>)<commit_after># Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
#

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  protect_from_forgery # See ActionController::RequestForgeryProtection for details
  Mime::Type.register "image/jpeg", :jpg

  include ChecksAuthentication
  before_filter :check_authentication
  rescue_from( AuthFailure ) { |e| handle_authentication_failure(e) }

  # Scrub sensitive parameters from your log
  filter_parameter_logging :password

  rescue_from( ErrorResponse ) { |e| render_error_response(e) }
 
  def render_error_response(ex)
    @exception = ex
 
    # Only add the error page to the status code if the request-format was HTML
    respond_to do |format|
      format.html do
        render( 
          :template => "shared/status_#{ex.status_code.to_s}",
{'fraction_non_alphanumeric': 0.06988436400201106, 'fraction_numerical': 0.0, 'mean_word_length': 4.422343324250681, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '5887894', 'n_tokens_mistral': 552, 'n_tokens_neox': 533, 'n_words': 188}