<commit_before>class ListController < ApplicationController

  before_filter :ensure_logged_in, except: [:latest, :hot, :category, :category_feed]
  skip_before_filter :check_xhr

  # Create our filters
  [:latest, :hot, :favorited, :read, :posted, :unread, :new].each do |filter|
    define_method(filter) do
      list_opts = {page: params[:page]}

      # html format means we need to farm exclude from the site options
      if params[:format].blank? || params[:format] == "html"
        #TODO objectify this stuff
        SiteSetting.top_menu.split('|').each do |f|
          s = f.split(",")
          if s[0] == action_name || (action_name == "index" && s[0] == SiteSetting.homepage)
            list_opts[:exclude_category] = s[1][1..-1] if s.length == 2
          end
        end
      end
      list_opts[:exclude_category] = params[:exclude_category] if params[:exclude_category].present?

      list = TopicQuery.new(current_user, list_opts).send("list_#{filter}")
      list.more_topics_url = url_for(self.send "#{filter}_path".to_sym, list_opts.merge(format: 'json', page: next_page))

      respond(list)
    end
  end

  def category
    query = TopicQuery.new(current_user, page: params[:page])
    list = nil

    # If they choose uncategorized, return topics NOT in a category
    if params[:category] == Slug.for(SiteSetting.uncategorized_name) or params[:category] == SiteSetting.uncategorized_name or params[:category] == 'null-category'
      list = query.list_uncategorized
    else
      @category = Category.where("slug = ? or id = ?", params[:category], params[:category].to_i).includes(:featured_users).first
      guardian.ensure_can_see!(@category)
      list = query.list_category(@category)
    end

    list.more_topics_url = url_for(category_path(params[:category], page: next_page, format: "json"))
    respond(list)
  end

  def category_feed
    raise Discourse::InvalidParameters.new('Category RSS of "uncategorized"') if params[:category] == Slug.for(SiteSetting.uncategorized_name) || params[:category] == SiteSetting.uncategorized_name

    @category = Category.where("slug = ?", params[:category]).includes(:featured_users).first
<commit_msg>url for uncategorized category topic list is always /category/uncategorized<commit_after>class ListController < ApplicationController

  before_filter :ensure_logged_in, except: [:latest, :hot, :category, :category_feed]
  skip_before_filter :check_xhr

  # Create our filters
  [:latest, :hot, :favorited, :read, :posted, :unread, :new].each do |filter|
    define_method(filter) do
      list_opts = {page: params[:page]}

      # html format means we need to farm exclude from the site options
      if params[:format].blank? || params[:format] == "html"
        #TODO objectify this stuff
        SiteSetting.top_menu.split('|').each do |f|
          s = f.split(",")
          if s[0] == action_name || (action_name == "index" && s[0] == SiteSetting.homepage)
            list_opts[:exclude_category] = s[1][1..-1] if s.length == 2
          end
        end
      end
      list_opts[:exclude_category] = params[:exclude_category] if params[:exclude_category].present?

      list = TopicQuery.new(current_user, list_opts).send("list_#{filter}")
      list.more_topics_url = url_for(self.send "#{filter}_path".to_sym, list_opts.merge(format: 'json', page: next_page))

      respond(list)
    end
  end

  def category
    query = TopicQuery.new(current_user, page: params[:page])
    list = nil

    # If they choose uncategorized, return topics NOT in a category
    if params[:category] == 'uncategorized'
      list = query.list_uncategorized
    else
      @category = Category.where("slug = ? or id = ?", params[:category], params[:category].to_i).includes(:featured_users).first
      guardian.ensure_can_see!(@category)
      list = query.list_category(@category)
    end

    list.more_topics_url = url_for(category_path(params[:category], page: next_page, format: "json"))
    respond(list)
  end

  def category_feed
    raise Discourse::InvalidParameters.new('Category RSS of "uncategorized"') if params[:category] == Slug.for(SiteSetting.uncategorized_name) || params[:category] == SiteSetting.uncategorized_name

    @category = Category.where("slug = ?", params[:category]).includes(:featured_users).first

{'fraction_non_alphanumeric': 0.13178654292343386, 'fraction_numerical': 0.0027842227378190253, 'mean_word_length': 3.949483352468427, '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': '6867976', 'n_tokens_mistral': 1338, 'n_tokens_neox': 1326, 'n_words': 300}