<commit_before>class ApplicationController < ActionController::Base

  protect_from_forgery
  helper_method :current_user
  helper_method :user_signed_in?
  helper_method :correct_user?

  private

  def current_user
    begin
      @current_user ||= User.find(session[:user_id]) if session[:user_id]
    rescue Exception => e
      nil
    end
  end

  def user_signed_in?
    return true if current_user
  end

  def correct_user?
    @user = User.find(params[:id])
    unless current_user == @user
      redirect_to root_url, :alert => "Access denied."
    end
  end

  def authenticate_user!
    if !current_user
      redirect_to root_url, :alert => 'You need to sign in for access to this page.'
    end
  end

  # Internal: PhotoStore required for current user.
  def photo_store_required!
    if !current_photo_store
      redirect_to account_path, :alert => "You need to configure S3 for your account."
    end
  end

  # Internal: The photo store for the current user if it exists.
  #
  # Returns a PhotoStore or nil.
  def current_photo_store
    current_user.photo_store<commit_msg>Remove unused method.<commit_after>class ApplicationController < ActionController::Base

  protect_from_forgery
  helper_method :current_user
  helper_method :user_signed_in?

  private

  def current_user
    begin
      @current_user ||= User.find(session[:user_id]) if session[:user_id]
    rescue Exception => e
      nil
    end
  end

  def user_signed_in?
    return true if current_user
  end

  def authenticate_user!
    if !current_user
      redirect_to root_url, :alert => 'You need to sign in for access to this page.'
    end
  end

  # Internal: PhotoStore required for current user.
  def photo_store_required!
    if !current_photo_store
      redirect_to account_path, :alert => "You need to configure S3 for your account."
    end
  end

  # Internal: The photo store for the current user if it exists.
  #
  # Returns a PhotoStore or nil.
  def current_photo_store
    current_user.photo_store
{'fraction_non_alphanumeric': 0.06371329019412643, 'fraction_numerical': 0.0009955201592832255, 'mean_word_length': 3.3506493506493507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, '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': '4320028', 'n_tokens_mistral': 615, 'n_tokens_neox': 599, 'n_words': 197}