<commit_before>class BlogPostsController < ApplicationController
	unloadable
	
	helper :blog
	
	layout :choose_layout
	
	before_filter :require_user, :except => [:index, :show]
	before_filter :require_admin, :except => [:index, :show]
	before_filter :setup_image_template, :only => [:new, :edit, :create, :update]

  def index
    @blog_posts = BlogPost.published.paginate(:page => params[:page], :per_page => 5)
    @index_title = BlogKit.instance.settings['blog_name'] || 'Blog'
    @ads = false

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @blog_posts }
      format.atom 
    end
  end

  def drafts
    @blog_posts = BlogPost.drafts.paginate(:page => params[:page], :order => 'updated_at DESC')

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @blog_posts }
    end
  end

  def show
    @blog_post = BlogPost.find(params[:id])
    @blog_comment = @blog_post.blog_comments.new<commit_msg>require admin access for viewing drafts<commit_after>class BlogPostsController < ApplicationController
	unloadable
	
	helper :blog
	
	layout :choose_layout
	
	before_filter :require_user, :except => [:index, :show]
	before_filter :require_admin, :except => [:index, :show]
	before_filter :setup_image_template, :only => [:new, :edit, :create, :update]

  def index
    @blog_posts = BlogPost.published.paginate(:page => params[:page], :per_page => 5)
    @index_title = BlogKit.instance.settings['blog_name'] || 'Blog'
    @ads = false

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @blog_posts }
      format.atom 
    end
  end

  def drafts
    @blog_posts = BlogPost.drafts.paginate(:page => params[:page], :order => 'updated_at DESC')

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @blog_posts }
    end
  end

  def show
    @blog_post = BlogPost.find(params[:id])
    unless @blog_post.published == 1
      require_admin
      return
    end
    @blog_comment = @blog_post.blog_comments.new
{'fraction_non_alphanumeric': 0.12416427889207259, 'fraction_numerical': 0.0014326647564469914, 'mean_word_length': 3.534632034632035, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 8}, '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': '2875733', 'n_tokens_mistral': 712, 'n_tokens_neox': 675, 'n_words': 158}