<commit_before>class BlogController < ApplicationController
  before_filter :find_post, only: [:show]
  POSTS_PER_PAGE = 6

  def index
    unless params[:page] and params[:page].to_i >= 0
      @page = 0
    else
      @page = params[:page].to_i
    end

    @total_pages = (BlogPost.all.count / POSTS_PER_PAGE).ceil

    @posts = BlogPost.all.slice(@page * POSTS_PER_PAGE, POSTS_PER_PAGE)

    if @posts.blank?
      redirect_to(blog_index_path)
    end
  end

  def show
    if stale?(@post, public: true)<commit_msg>Put the constant at the top<commit_after>class BlogController < ApplicationController
  POSTS_PER_PAGE = 6

  before_filter :find_post, only: [:show]

  def index
    unless params[:page] and params[:page].to_i >= 0
      @page = 0
    else
      @page = params[:page].to_i
    end

    @total_pages = (BlogPost.all.count / POSTS_PER_PAGE).ceil

    @posts = BlogPost.all.slice(@page * POSTS_PER_PAGE, POSTS_PER_PAGE)

    if @posts.blank?
      redirect_to(blog_index_path)
    end
  end

  def show
    if stale?(@post, public: true)
{'fraction_non_alphanumeric': 0.1061611374407583, 'fraction_numerical': 0.005687203791469194, 'mean_word_length': 3.2071713147410357, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '503273', 'n_tokens_mistral': 391, 'n_tokens_neox': 360, 'n_words': 84}