<commit_before>class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception
  before_action :authenticate_user!
  before_action :set_locale
  before_action :set_copyright_year
  before_action :bake_breadcrumbs

  def styleguide
  end

  private

  def set_locale
    I18n.locale = params[:locale].to_sym
  rescue
    I18n.locale = :en
  end

  def set_copyright_year
    require 'date'
    @current_year = Date.today.strftime("%Y")
  end

  def bake_breadcrumbs
    breadcrumb_bakery = BreadcrumbBakery.new(request.env['PATH_INFO'])
    @breadcrumbs = breadcrumb_bakery.get_breadcrumbs
  end

  # This method smells of :reek:UtilityFunction
  def default_url_options(options = {})
    { locale: I18n.locale }.merge options
  end
end
<commit_msg>disable breadcrumbs for non existing user sessions<commit_after>class ApplicationController < ActionController::Base
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :exception
  before_action :authenticate_user!
  before_action :set_locale
  before_action :set_copyright_year
  before_action :bake_breadcrumbs

  def styleguide
  end

  private

  def set_locale
    I18n.locale = params[:locale].to_sym
  rescue
    I18n.locale = :en
  end

  def set_copyright_year
    require 'date'
    @current_year = Date.today.strftime("%Y")
  end

  def bake_breadcrumbs
    @breadcrumbs = []
    return unless user_signed_in?
    breadcrumb_bakery = BreadcrumbBakery.new(request.env['PATH_INFO'])
    @breadcrumbs = breadcrumb_bakery.get_breadcrumbs
  end

  # This method smells of :reek:UtilityFunction
  def default_url_options(options = {})
    { locale: I18n.locale }.merge options
  end
end

{'fraction_non_alphanumeric': 0.07146695325094035, 'fraction_numerical': 0.006448146157979581, 'mean_word_length': 4.245070422535211, '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': '3941305', 'n_tokens_mistral': 631, 'n_tokens_neox': 614, 'n_words': 148}