<commit_before>class ArticlesController < ApplicationController
  before_filter :login_required, :except => [:index, :home, :list, :show]

  def index
    list
    render :action => 'list'
  end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }

  def home
    @articles = Article.find(:all, :conditions => published_sql(self.controller_name), :include => [:author], :order => "articles.created_at, articles.id DESC", :limit => "3")
    render :template => 'layouts/home'
  end

  def list
    @article_pages, @articles = paginate :articles, :conditions => published_sql(self.controller_name), :include => [:author], :order => "articles.created_at, articles.id DESC", :per_page => 10
    @page_title = "Articles"
  end

  def show
    @article   = Article.find(params[:id], :conditions => published_sql(self.controller_name))
    @recent_articles = Article.find(:all, :conditions => published_sql(self.controller_name), :order => "articles.created_at, articles.id DESC", :limit => "10")
    @page_title = @article.title if @article
  end

  def new
    @authors = Person.find(:all, :conditions => 'deleted = 0', :order => "fullname ASC")
    @article = Article.new
  end
  
  def create<commit_msg>Now fetching upcoming events to display on homepage<commit_after>class ArticlesController < ApplicationController
  before_filter :login_required, :except => [:index, :home, :list, :show]

  def index
    list
    render :action => 'list'
  end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :only => [ :destroy, :create, :update ],
         :redirect_to => { :action => :list }

  def home
    @articles = Article.find(:all, :conditions => published_sql(self.controller_name), :include => [:author], :order => "articles.created_at, articles.id DESC", :limit => "3")
    @upcoming_events = Event.find(:all, :conditions => "#{published_sql("events", "published")} AND events.date >= CURRENT_DATE() ")
    render :template => 'layouts/home'
  end

  def list
    @article_pages, @articles = paginate :articles, :conditions => published_sql(self.controller_name), :include => [:author], :order => "articles.created_at, articles.id DESC", :per_page => 10
    @page_title = "Articles"
  end

  def show
    @article   = Article.find(params[:id], :conditions => published_sql(self.controller_name))
    @recent_articles = Article.find(:all, :conditions => published_sql(self.controller_name), :order => "articles.created_at, articles.id DESC", :limit => "10")
    @page_title = @article.title if @article
  end

  def new
    @authors = Person.find(:all, :conditions => 'deleted = 0', :order => "fullname ASC")
    @article = Article.new
  end
  
  def create
{'fraction_non_alphanumeric': 0.1551663747810858, 'fraction_numerical': 0.007705779334500876, 'mean_word_length': 4.25, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5815954', 'n_tokens_mistral': 935, 'n_tokens_neox': 886, 'n_words': 226}