<commit_before>class AuthorsController < ApplicationController
  # GET /authors
  def index(period = "all")
    total_entries = BibliomeStat.last_cached.send("#{period}_authors")
    @authors = Author.search params[:q], :page => params[:page], :order => AUTHOR_ORDER[period], :conditions => "#{period}_total > 0", :total_entries => total_entries
    @period = period

    respond_to do |format|
      format.html { render :action => "index"}
    end
  end

  def one
    if params[:id].nil?
      index("one")
    else
      show("one")
    end
  end
  
  def five
    if params[:id].nil?
      index("five")
    else
      show("five")
    end
  end
  
  def ten
    if params[:id].nil?
      index("ten")
    else
      show("ten")
    end
  end
  
  def all
    if params[:id].nil?
      index("all")
    else
      show("all")
    end
  end

  # GET /authors/1
  def show(period = "all")
    @period = period
    @author = Author.find(params[:id])
    total_entries = @author.send("#{period}_total")
    per_page = total_entries < 8 ? total_entries : 8
    #per_page = 1 if per_page == 0
    @articles = []
    @articles = @author.articles.paginate :page => params[:page], :order => "pubdate desc", :per_page => per_page, :total_entries => total_entries if total_entries == 0
    respond_to do |format|
      format.html  { render :action => "show"}
    end
  end
end<commit_msg>fixed bug: find articles when there are articles<commit_after>class AuthorsController < ApplicationController
  # GET /authors
  def index(period = "all")
    total_entries = BibliomeStat.last_cached.send("#{period}_authors")
    @authors = Author.search params[:q], :page => params[:page], :order => AUTHOR_ORDER[period], :conditions => "#{period}_total > 0", :total_entries => total_entries
    @period = period

    respond_to do |format|
      format.html { render :action => "index"}
    end
  end

  def one
    if params[:id].nil?
      index("one")
    else
      show("one")
    end
  end
  
  def five
    if params[:id].nil?
      index("five")
    else
      show("five")
    end
  end
  
  def ten
    if params[:id].nil?
      index("ten")
    else
      show("ten")
    end
  end
  
  def all
    if params[:id].nil?
      index("all")
    else
      show("all")
    end
  end

  # GET /authors/1
  def show(period = "all")
    @period = period
    @author = Author.find(params[:id])
    total_entries = @author.send("#{period}_total")
    per_page = total_entries < 8 ? total_entries : 8
    #per_page = 1 if per_page == 0
    @articles = []
    @articles = @author.articles.paginate :page => params[:page], :order => "pubdate desc", :per_page => per_page, :total_entries => total_entries if total_entries > 0
    respond_to do |format|
      format.html  { render :action => "show"}
    end
  end
end
{'fraction_non_alphanumeric': 0.1392857142857143, 'fraction_numerical': 0.005, 'mean_word_length': 2.754691689008043, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 26, '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': '5433880', 'n_tokens_mistral': 933, 'n_tokens_neox': 900, 'n_words': 236}