<commit_before>class Exceptions < Merb::Controller
  provides :xml, :yaml, :js  
  # handle NotFound exceptions (404)
  def not_found
    if request.xhr?
      return("Sorry! Not found.")
    elsif request.env['HTTP_REFERER']
      redirect request.env['HTTP_REFERER'], :message => { :error => 'Sorry, page not found' }
    else
      render :status => 404
    end
  end

  # handle NotAcceptable exceptions (400)
  def bad_request
    if request.xhr?
      return("Sorry! Missing parameters. Please fill the form correctly")
    elsif request.env['HTTP_REFERER']
      redirect request.env['HTTP_REFERER'], :message => { :error => 'Sorry! Missing parameters. Please fill the form correctly' }
    else
      render :format => :html, :layout => layout?, :status => 400
    end<commit_msg>change for page not found error handling<commit_after>class Exceptions < Merb::Controller
  provides :xml, :yaml, :js  
  # handle NotFound exceptions (404)
  def not_found
    if request.xhr?
      return("Sorry! Not found.")
    elsif request.env['HTTP_REFERER']
      redirect request.env['HTTP_REFERER'], :message => { :error => 'Sorry, page not found' }
    else
#      only_provides :xml
      render :status => 404
    end
  end

  # handle NotAcceptable exceptions (400)
  def bad_request
    if request.xhr?
      return("Sorry! Missing parameters. Please fill the form correctly")
    elsif request.env['HTTP_REFERER']
      redirect request.env['HTTP_REFERER'], :message => { :error => 'Sorry! Missing parameters. Please fill the form correctly' }
    else
      render :format => :html, :layout => layout?, :status => 400
    end
{'fraction_non_alphanumeric': 0.11663597298956414, 'fraction_numerical': 0.014732965009208104, 'mean_word_length': 3.3699731903485253, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 3}, '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': '790167', 'n_tokens_mistral': 502, 'n_tokens_neox': 477, 'n_words': 153}