<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
  include AuthenticatedSystem
  include CurrentTags
  protect_from_forgery

  before_filter :find_current_tags
  before_filter :set_locale

  protected
  def find_current_tags
    @current_tags ||= begin
      tags = []
      if params[:tags]
        tags += params[:tags].kind_of?(Array) ? params[:tags] : [params[:tags]]
      end
      if current_tag.present?
        tags += [current_tag]
      end
      tags
    end
  end
  alias :current_tags :find_current_tags

  def scoped_conditions(conditions = {})

    if current_tags && !current_tags.empty?
      conditions.deep_merge!({:tags => current_tags})
    end

    if current_user && !current_user.preferred_languages.empty?
      conditions.deep_merge!({:language => {:$in => current_user.preferred_languages }})
    end

    conditions
  end

  def available_locales; AVAILABLE_LOCALES; end

  def set_locale
    locale = 'en'
    if logged_in?
      locale = current_user.language
    else
      if request.env['Accept-Language'] =~ /^(\w\w)/
        lang = $1
        case lang
        when 'es'
          locale = 'es-AR'
        end
      end
    end

    I18n.locale = locale
  end
end<commit_msg>fix env variable name<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
  include AuthenticatedSystem
  include CurrentTags
  protect_from_forgery

  before_filter :find_current_tags
  before_filter :set_locale

  protected
  def find_current_tags
    @current_tags ||= begin
      tags = []
      if params[:tags]
        tags += params[:tags].kind_of?(Array) ? params[:tags] : [params[:tags]]
      end
      if current_tag.present?
        tags += [current_tag]
      end
      tags
    end
  end
  alias :current_tags :find_current_tags

  def scoped_conditions(conditions = {})

    if current_tags && !current_tags.empty?
      conditions.deep_merge!({:tags => current_tags})
    end

    if current_user && !current_user.preferred_languages.empty?
      conditions.deep_merge!({:language => {:$in => current_user.preferred_languages }})
    end

    conditions
  end

  def available_locales; AVAILABLE_LOCALES; end

  def set_locale
    locale = 'en'
    if logged_in?
      locale = current_user.language
    else
      if request.env['HTTP_ACCEPT_LANGUAGE'] =~ /^(\w\w)/
        lang = $1
        case lang
        when 'es'
          locale = 'es-AR'
        end
      end
    end

    I18n.locale = locale
  end
end
{'fraction_non_alphanumeric': 0.08881697231211794, 'fraction_numerical': 0.002157497303128371, 'mean_word_length': 2.8585298196948683, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '3004340', 'n_tokens_mistral': 851, 'n_tokens_neox': 826, 'n_words': 218}