<commit_before>class ArticlesController < ApplicationController
  before_filter :find_article_by_params, only: [:show, :edit, :update, :destroy]
  before_filter :decorate_article, only: [
    :show,
    :edit,
    :toggle_archived,
    :toggle_subscription,
    :toggle_endorsement,
    :report_rot,
    :mark_fresh
  ]
  respond_to :html, :json

  def archived
    @archived_articles = ArticleDecorator.decorate_collection(Article.archived.includes(:tags))
  end

  def index
    @articles = ArticleDecorator.decorate_collection(Article.current.includes(:tags).text_search(params[:search]))
    @guides = ArticleDecorator.decorate_collection(Article.guide)
  end

  def show
    respond_with @article
  end

  def new
    @article = Article.new.decorate
  end

  def create
    @article = Article.new(article_params)
    redirect_to article_path(@article) if @article.save
  end

  def edit
    @tags = @article.tags.collect{ |t| Hash["id" => t.id, "name" => t.name] }
  end

  def toggle_archived
    !@article.archived? ? @article.archive! : @article.unarchive!

    flash[:notice] = "Successfully #{@article.archived? ? "archived" : "unarchived"} this article."
    respond_with @article
  end<commit_msg>Inject title params in new article form<commit_after>class ArticlesController < ApplicationController
  before_filter :find_article_by_params, only: [:show, :edit, :update, :destroy]
  before_filter :decorate_article, only: [
    :show,
    :edit,
    :toggle_archived,
    :toggle_subscription,
    :toggle_endorsement,
    :report_rot,
    :mark_fresh
  ]
  respond_to :html, :json

  def archived
    @archived_articles = ArticleDecorator.decorate_collection(Article.archived.includes(:tags))
  end

  def index
    @articles = ArticleDecorator.decorate_collection(Article.current.includes(:tags).text_search(params[:search]))
    @guides = ArticleDecorator.decorate_collection(Article.guide)
  end

  def show
    respond_with @article
  end

  def new
    @article = Article.new(title: params[:title]).decorate
  end

  def create
    @article = Article.new(article_params)
    redirect_to article_path(@article) if @article.save
  end

  def edit
    @tags = @article.tags.collect{ |t| Hash["id" => t.id, "name" => t.name] }
  end

  def toggle_archived
    !@article.archived? ? @article.archive! : @article.unarchive!

    flash[:notice] = "Successfully #{@article.archived? ? "archived" : "unarchived"} this article."
    respond_with @article
  end
{'fraction_non_alphanumeric': 0.11430887717875962, 'fraction_numerical': 0.0, 'mean_word_length': 4.206751054852321, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6872686', 'n_tokens_mistral': 821, 'n_tokens_neox': 791, 'n_words': 164}