<commit_before>class ApplicationController < ActionController::Base
  protect_from_forgery

  before_filter :set_default_group
  
  helper_method :current_user_session, :current_user

  protected
  
  def authenticate
    authenticate_or_request_with_http_basic do |username, password|
      username == "politwoops" && password == "<PASSWORD>"
    end
  end
    
  private

  def set_default_group
    group_name = params.has_key?(:group_name) ? params[:group_name] : request.host.sub(/^www\./i, '')
    @default_group = Group.where(:name => group_name).first
    #set the language too
    I18n.locale = @default_group.language
  end
  
  def current_user_session
    return @current_user_session if defined?(@current_user_session)
    @current_user_session = UserSession.find
  end

  def current_user
    return @current_user if defined?(@current_user)
    @current_user = current_user_session && current_user_session.user
  end<commit_msg>Set quicker i18n backend.<commit_after>class ApplicationController < ActionController::Base
  protect_from_forgery

  before_filter :set_default_group
  
  helper_method :current_user_session, :current_user

  protected
  
  def authenticate
    authenticate_or_request_with_http_basic do |username, password|
      username == "politwoops" && password == "<PASSWORD>"
    end
  end
    
  private

  def set_default_group
    group_name = params.has_key?(:group_name) ? params[:group_name] : request.host.sub(/^www\./i, '')
    @default_group = Group.where(:name => group_name).first
    #set the language too
    # plus the backend
    I18n::Backend::Simple.send(:include, I18n::Backend::Flatten)
    I18n.locale = @default_group.language
  end
  
  def current_user_session
    return @current_user_session if defined?(@current_user_session)
    @current_user_session = UserSession.find
  end

  def current_user
    return @current_user if defined?(@current_user)
    @current_user = current_user_session && current_user_session.user
  end
{'fraction_non_alphanumeric': 0.08811681772406849, 'fraction_numerical': 0.005035246727089627, 'mean_word_length': 4.399456521739131, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5383151', 'n_tokens_mistral': 627, 'n_tokens_neox': 610, 'n_words': 123}