<commit_before>class Admin::GithubRepositoriesController < Admin::ApplicationController
  def show
    @github_repository = GithubRepository.find(params[:id])
  end

  def update
    @github_repository = GithubRepository.find(params[:id])
    if @github_repository.update_attributes(github_repository_params)
      @github_repository.update_all_info_async
      redirect_to github_repository_path(@github_repository.owner_name, @github_repository.project_name)
    else
      redirect_to admin_github_repository_path(@github_repository.id)
    end
  end

  def index
    if params[:language].present?
      @language = GithubRepository.language(params[:language].downcase).first.try(:language)
      raise ActiveRecord::RecordNotFound if @language.nil?
      scope = GithubRepository.language(@language)
    else
      scope = GithubRepository
    end

    @languages = GithubRepository.maintained.without_license.with_projects.group('github_repositories.language').count.sort_by(&:last).reverse
    @github_repositories = scope.maintained.without_license.with_projects.order("COUNT(projects.id) DESC").group("github_repositories.id").paginate(page: params[:page])
  end

  def mit
    @github_repositories = GithubRepository.with_projects.language('Go').without_license.group('github_repositories.id').includes(:readme).order("COUNT(projects.id) DESC").paginate(page: params[:page], per_page: 20)
  end

  private

  def github_repository_params
    params.require(:github_repository).permit(:license, :status)
  end
end<commit_msg>Only show top 20 language facets<commit_after>class Admin::GithubRepositoriesController < Admin::ApplicationController
  def show
    @github_repository = GithubRepository.find(params[:id])
  end

  def update
    @github_repository = GithubRepository.find(params[:id])
    if @github_repository.update_attributes(github_repository_params)
      @github_repository.update_all_info_async
      redirect_to github_repository_path(@github_repository.owner_name, @github_repository.project_name)
    else
      redirect_to admin_github_repository_path(@github_repository.id)
    end
  end

  def index
    if params[:language].present?
      @language = GithubRepository.language(params[:language].downcase).first.try(:language)
      raise ActiveRecord::RecordNotFound if @language.nil?
      scope = GithubRepository.language(@language)
    else
      scope = GithubRepository
    end

    @languages = GithubRepository.maintained.without_license.with_projects.group('github_repositories.language').count.sort_by(&:last).reverse.first(20)
    @github_repositories = scope.maintained.without_license.with_projects.order("COUNT(projects.id) DESC").group("github_repositories.id").paginate(page: params[:page])
  end

  def mit
    @github_repositories = GithubRepository.with_projects.language('Go').without_license.group('github_repositories.id').includes(:readme).order("COUNT(projects.id) DESC").paginate(page: params[:page], per_page: 20)
  end

  private

  def github_repository_params
    params.require(:github_repository).permit(:license, :status)
  end
end
{'fraction_non_alphanumeric': 0.1050080775444265, 'fraction_numerical': 0.002584814216478191, 'mean_word_length': 5.658064516129032, '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': '252261', 'n_tokens_mistral': 907, 'n_tokens_neox': 868, 'n_words': 128}