<commit_before>require 'api_entity'
require "slimmer/headers"
require 'gds_api/helpers'

class ApplicationController < ActionController::Base
  protect_from_forgery
  include Slimmer::Headers
  include GdsApi::Helpers

  before_filter :initialize_modules
  before_filter :set_cache
  before_filter :load_artefact
  after_filter :set_analytics_headers

  layout :set_layout

  rescue_from Errno::ECONNREFUSED do |e|
    render text: '', status: :error
  end
  rescue_from ApiEntity::NotFound do ||
    render text: '404', status: 404
  end
  rescue_from ApiEntity::Error do |e|
    render text: '', status: :error
  end

  def url_options
    { as_of: @tariff_date }.merge(super)
  end

  private
<commit_msg>Do not break if URL contains invalid symbols.<commit_after>require 'api_entity'
require "slimmer/headers"
require 'gds_api/helpers'

class ApplicationController < ActionController::Base
  protect_from_forgery
  include Slimmer::Headers
  include GdsApi::Helpers

  before_filter :initialize_modules
  before_filter :set_cache
  before_filter :load_artefact
  after_filter :set_analytics_headers

  layout :set_layout

  rescue_from Errno::ECONNREFUSED do |e|
    render text: '', status: :error
  end

  rescue_from ApiEntity::NotFound do ||
    render text: '404', status: 404
  end

  rescue_from ApiEntity::Error do |e|
    render text: '', status: :error
  end

  rescue_from URI::InvalidURIError do |e|
    render text: '404', status: 404
  end

  def url_options
    { as_of: @tariff_date }.merge(super)
  end

  private

{'fraction_non_alphanumeric': 0.08338762214983714, 'fraction_numerical': 0.011726384364820847, 'mean_word_length': 4.605839416058394, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7137643', 'n_tokens_mistral': 514, 'n_tokens_neox': 504, 'n_words': 133}