<commit_before>class ErrsController < ApplicationController
  include ActionView::Helpers::TextHelper

  before_filter :find_app, :except => [:index, :all, :destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several]
  before_filter :find_problem, :except => [:index, :all, :destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several]
  before_filter :find_selected_problems, :only => [:destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several]

  def index
    app_scope = current_user.admin? ? App.all : current_user.apps

    @sort = params[:sort]
    @order = params[:order]
    @sort = "app" unless %w{message last_notice_at last_deploy_at count}.member?(@sort)
    @order = "asc" unless (@order == "desc")

    @problems = Problem.for_apps(app_scope).in_env(params[:environment]).unresolved.ordered_by(@sort, @order)
    @selected_problems = params[:problems] || []
    respond_to do |format|
      format.html do
        @problems = @problems.paginate(:page => params[:page], :per_page => current_user.per_page)
      end
      format.atom
    end
  end

  def all
    app_scope = current_user.admin? ? App.all : current_user.apps
    @problems = Problem.for_apps(app_scope).ordered.paginate(:page => params[:page], :per_page => current_user.per_page)
    @selected_problems = params[:problems] || []
  end

  def show
    page      = (params[:notice] || @problem.notices_count)<commit_msg>Changed default sorting<commit_after>class ErrsController < ApplicationController
  include ActionView::Helpers::TextHelper

  before_filter :find_app, :except => [:index, :all, :destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several]
  before_filter :find_problem, :except => [:index, :all, :destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several]
  before_filter :find_selected_problems, :only => [:destroy_several, :resolve_several, :unresolve_several, :merge_several, :unmerge_several]

  def index
    app_scope = current_user.admin? ? App.all : current_user.apps

    @sort = params[:sort]
    @sort = "last_notice_at" unless %w{app message last_notice_at last_deploy_at count}.member?(@sort)
    @order = params[:order] || "desc"

    @problems = Problem.for_apps(app_scope).in_env(params[:environment]).unresolved.ordered_by(@sort, @order)
    @selected_problems = params[:problems] || []
    respond_to do |format|
      format.html do
        @problems = @problems.paginate(:page => params[:page], :per_page => current_user.per_page)
      end
      format.atom
    end
  end

  def all
    app_scope = current_user.admin? ? App.all : current_user.apps
    @problems = Problem.for_apps(app_scope).ordered.paginate(:page => params[:page], :per_page => current_user.per_page)
    @selected_problems = params[:problems] || []
  end

  def show
    page      = (params[:notice] || @problem.notices_count)
{'fraction_non_alphanumeric': 0.1313301823092505, 'fraction_numerical': 0.0, 'mean_word_length': 5.0101419878296145, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '7537812', 'n_tokens_mistral': 1036, 'n_tokens_neox': 939, 'n_words': 184}