<commit_before>class Admin::PagesController < AlchemyController
  
  helper :pages
  
  layout 'alchemy'
  
  before_filter :set_translation, :except => [:show]
  before_filter :get_page_from_id, :only => [:show, :unlock, :publish, :configure, :edit, :update, :destroy, :fold]
  
  filter_access_to [:show, :unlock, :publish, :configure, :edit, :update, :destroy], :attribute_check => true
  filter_access_to [:index, :link, :layoutpages, :new, :switch_language, :create, :fold, :move, :flush], :attribute_check => false
  
  cache_sweeper :pages_sweeper, :only => [:publish], :if => Proc.new { |c| Alchemy::Configuration.parameter(:cache_pages) }
  
  def index
    @page_root = Page.language_root_for(session[:language_id])
    @locked_pages = Page.all_locked_by(current_user)
  end
  
  def show
    # fetching page via before filter
    @preview_mode = true
    @language = Alchemy::Controller.current_language
    @root_page = Page.language_root_for(session[:language_id])
    render :layout => params[:layout].blank? ? 'pages' : params[:layout] == 'none' ? false : params[:layout]
  end
  
  def new
    @page = Page.new(:layoutpage => params[:layoutpage] == 'true', :parent_id => params[:parent_id])
    @page_layouts = Alchemy::PageLayout.get_layouts_for_select(session[:language_id], @page.layoutpage?)
    @clipboard_items = Page.all_from_clipboard_for_select(get_clipboard('pages'), session[:language_id], @page.layoutpage?)
    render :layout => false
  end<commit_msg>Setting correct I18n.locale for Admin::Pages.show (preview)<commit_after>class Admin::PagesController < AlchemyController
  
  helper :pages
  
  layout 'alchemy'
  
  before_filter :set_translation, :except => [:show]
  before_filter :get_page_from_id, :only => [:show, :unlock, :publish, :configure, :edit, :update, :destroy, :fold]
  
  filter_access_to [:show, :unlock, :publish, :configure, :edit, :update, :destroy], :attribute_check => true
  filter_access_to [:index, :link, :layoutpages, :new, :switch_language, :create, :fold, :move, :flush], :attribute_check => false
  
  cache_sweeper :pages_sweeper, :only => [:publish], :if => Proc.new { |c| Alchemy::Configuration.parameter(:cache_pages) }
  
  def index
    @page_root = Page.language_root_for(session[:language_id])
    @locked_pages = Page.all_locked_by(current_user)
  end
  
  def show
    # fetching page via before filter
    @preview_mode = true
    I18n.locale = session[:language_code]
    @root_page = Page.language_root_for(session[:language_id])
    render :layout => params[:layout].blank? ? 'pages' : params[:layout] == 'none' ? false : params[:layout]
  end
  
  def new
    @page = Page.new(:layoutpage => params[:layoutpage] == 'true', :parent_id => params[:parent_id])
    @page_layouts = Alchemy::PageLayout.get_layouts_for_select(session[:language_id], @page.layoutpage?)
    @clipboard_items = Page.all_from_clipboard_for_select(get_clipboard('pages'), session[:language_id], @page.layoutpage?)
    render :layout => false
  end
{'fraction_non_alphanumeric': 0.14414414414414414, 'fraction_numerical': 0.001334668001334668, 'mean_word_length': 5.324894514767933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '7647101', 'n_tokens_mistral': 998, 'n_tokens_neox': 979, 'n_words': 204}