<commit_before>class PhotographsController < ApplicationController
  respond_to :html
  before_filter :authenticate_user!, only: [:favourites, :recommend, :following]
  before_filter :hide_filters!, only: [
    :recommended, :favourites, :following, :search, :seeking_feedback
  ]
  before_filter :enable_sharing_mode, only: :share

  before_filter :set_parents
  def set_parents
    if params[:collection_id].present?
      @collection = Collection.friendly.find(params[:collection_id])
      authorize! :read, @collection
    end

    if params[:user_id].present?
      @user = User.find_by_id_or_username(params[:user_id])

      if @user.nil?
        old_name = OldUsername.find_by(username: params[:user_id])
        if old_name.present?
          redirect_to user_photographs_path(old_name.user.username) and return
        end
      end
    end

    if params[:category_id].present?
      @category = Category.friendly.find(params[:category_id])
    end

    if params[:license_id].present?
      @license = License.friendly.find(params[:license_id])
    end
  end

  def index
    case
    when @collection.present?
      @photographs = @collection.photographs
      set_title(@collection.name)
      hide_filters!
    when @user.present?
      @photographs = @user.photographs
      set_title(@user.name)
      hide_filters!
    when @category.present?
      @photographs = @category.photographs
      set_title(@category.name)
    when @license.present?
      @photographs = @license.photographs
      set_title(@license.name)
    else
      @photographs = Photograph.all
    end

    @photographs = @photographs.view_for(current_user).uniq.order("created_at DESC").page(params[:page])
    respond_with @photographs
  end

  def explore
    @photographs = Photograph.view_for(current_user).uniq.order("created_at DESC").page(params[:page])
    set_title t("titles.explore")
<commit_msg>Don't show filters on license browsing<commit_after>class PhotographsController < ApplicationController
  respond_to :html
  before_filter :authenticate_user!, only: [:favourites, :recommend, :following]
  before_filter :hide_filters!, only: [
    :recommended, :favourites, :following, :search, :seeking_feedback
  ]
  before_filter :enable_sharing_mode, only: :share

  before_filter :set_parents
  def set_parents
    if params[:collection_id].present?
      @collection = Collection.friendly.find(params[:collection_id])
      authorize! :read, @collection
    end

    if params[:user_id].present?
      @user = User.find_by_id_or_username(params[:user_id])

      if @user.nil?
        old_name = OldUsername.find_by(username: params[:user_id])
        if old_name.present?
          redirect_to user_photographs_path(old_name.user.username) and return
        end
      end
    end

    if params[:category_id].present?
      @category = Category.friendly.find(params[:category_id])
    end

    if params[:license_id].present?
      @license = License.friendly.find(params[:license_id])
    end
  end

  def index
    case
    when @collection.present?
      @photographs = @collection.photographs
      set_title(@collection.name)
      hide_filters!
    when @user.present?
      @photographs = @user.photographs
      set_title(@user.name)
      hide_filters!
    when @category.present?
      @photographs = @category.photographs
      set_title(@category.name)
    when @license.present?
      @photographs = @license.photographs
      set_title(@license.name)
      hide_filters!
    else
      @photographs = Photograph.all
    end

    @photographs = @photographs.view_for(current_user).uniq.order("created_at DESC").page(params[:page])
    respond_with @photographs
  end

  def explore
    @photographs = Photograph.view_for(current_user).uniq.order("created_at DESC").page(params[:page])
    set_title t("titles.explore")

{'fraction_non_alphanumeric': 0.10581183216054209, 'fraction_numerical': 0.0, 'mean_word_length': 3.5964071856287427, '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': '5887905', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1156, 'n_words': 218}