<commit_before>  class AlbumsController < BaseController
  include ActionController::GuardsPermissions::InstanceMethods
  helper :roles

  before_filter :set_section
  before_filter :set_set, :set_tags, :set_photos, :only => :index
  before_filter :set_photo,                       :only => :show
  before_filter :guard_view_permissions,          :only => :show

  # TODO move :comments and @commentable to acts_as_commentable
  caches_page_with_references :index, :show, :comments,
    :track => ['@photo', '@photos', '@set', '@commentable', {'@site' => :tag_counts, '@section' => :tag_counts}]

  authenticates_anonymous_user
  acts_as_commentable

  def index
    respond_to do |format|
      format.html { render }
      # format.atom { render :layout => false }
    end
  end

  def show
    respond_to do |format|
      format.html { render }
      # format.atom { render :layout => false }
    end
  end

  protected
    def set_section; super(Album); end

    def set_photos
      # TODO that condition part would clearly go to model...
      options = { :page => current_page, :tags => @tags, :conditions => ["published_at IS NOT NULL"], :order => 'published_at DESC' }
      options[:limit] = request.format == :html ? @section.photos_per_page : 15
      # TODO i think a very expensive way to handle this one ;) .. throw away thing for now
      source = @set ? @section.photos.collect {|photo| photo if photo.sets.include?(@set) } : @section.photos
      @photos = source.paginate options
    end
<commit_msg>fixed couple of bugs with throwaway code of albums_controller<commit_after>  class AlbumsController < BaseController
  include ActionController::GuardsPermissions::InstanceMethods
  helper :roles

  before_filter :set_section
  before_filter :set_set, :set_tags, :set_photos, :only => :index
  before_filter :set_photo,                       :only => :show
  before_filter :guard_view_permissions,          :only => :show

  # TODO move :comments and @commentable to acts_as_commentable
  caches_page_with_references :index, :show, :comments,
    :track => ['@photo', '@photos', '@set', '@commentable', {'@site' => :tag_counts, '@section' => :tag_counts}]

  authenticates_anonymous_user
  acts_as_commentable

  def index
    respond_to do |format|
      format.html { render }
      # format.atom { render :layout => false }
    end
  end

  def show
    respond_to do |format|
      format.html { render }
      # format.atom { render :layout => false }
    end
  end

  protected
    def set_section; super(Album); end

    def set_photos
      # TODO that condition part would clearly go to model...
      options = { :page => current_page, :tags => @tags, :conditions => ["published_at IS NOT NULL"], :order => 'published_at DESC' }
      options[:limit] = request.format == :html ? @section.photos_per_page : 15
      # TODO i think a very expensive way to handle this one ;) .. throw away thing for now
      source = @set ? 
                @section.photos.collect {|photo| photo if photo.sets.include?(@set) && photo.published? }.compact :
                @section.photos
      @photos = source.paginate options
    end

{'fraction_non_alphanumeric': 0.11139320850523643, 'fraction_numerical': 0.0012694382735639479, 'mean_word_length': 3.2026666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '3223829', 'n_tokens_mistral': 953, 'n_tokens_neox': 914, 'n_words': 278}