<commit_before>class MediaController < ApplicationController
  # GET /media/1
  # GET /media/1.xml
  def show
    set_common_variables(session)
    @medium = Medium.find(params[:id])
    @features = Feature.paginate(:conditions => {'features.fid' => Medium.find(@medium.id).feature_ids, 'cached_feature_names.view_id' => current_view.id}, :include => {:cached_feature_names => :feature_name}, :order => 'feature_names.name', :page => params[:page] || 1, :per_page => 15)
    @object_type = "Media"
    @object_title = "Medium #{@medium.id}"
    @object_url = Medium.element_url(@medium.id, :format => 'html')
    @feature = Feature.find(session[:interface][:context_id]) unless session[:interface][:context_id].blank?
    respond_to do |format|
      format.html { render :template => 'features/list' } # show.html.erb
    end
  end
end<commit_msg>handlig errors for unexisting media<commit_after>class MediaController < ApplicationController
  # GET /media/1
  # GET /media/1.xml
  def show
    @medium = Medium.find(params[:id])
    if @medium.nil?
      redirect_to features_url
    else
      set_common_variables(session)
      @features = Feature.paginate(:conditions => {'features.fid' => Medium.find(@medium.id).feature_ids, 'cached_feature_names.view_id' => current_view.id}, :include => {:cached_feature_names => :feature_name}, :order => 'feature_names.name', :page => params[:page] || 1, :per_page => 15)
      @object_type = "Media"
      @object_title = "Medium #{@medium.id}"
      @object_url = Medium.element_url(@medium.id, :format => 'html')
      @feature = Feature.find(session[:interface][:context_id]) unless session[:interface][:context_id].blank?
      respond_to do |format|
        format.html { render :template => 'features/list' } # show.html.erb
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.15465631929046564, 'fraction_numerical': 0.005543237250554324, 'mean_word_length': 4.277777777777778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4133399', 'n_tokens_mistral': 582, 'n_tokens_neox': 564, 'n_words': 113}