<commit_before>module Caboose
  class ApplicationController < ActionController::Base

    protect_from_forgery  
    before_filter :before_before_action
    helper_method :logged_in?
    
    @find_page = true
    
    def before_before_action
      
      # Modify the built-in params array with URL params if necessary
      parse_url_params if Caboose.use_url_params
      
      
      session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
      
      # Initialize AB Testing
      AbTesting.init(request.session_options[:id]) if Caboose.use_ab_testing      
      
      # Try to find the page 
      @page = Page.new
      @crumb_trail  = []
      @subnav       = {}
      @actions      = {}
      @tasks        = {}
      @page_tasks   = {}
      @is_real_page = false
      
      if @find_page
        @page = Page.page_with_uri(request.fullpath)
        @crumb_trail  = Caboose::Page.crumb_trail(@page)		    
      end
      
      # Sets an instance variable of the logged in user
      @logged_in_user = logged_in_user      
      
      before_action
    end
    s
    # Parses any parameters in the URL and adds them to the params
    def parse_url_params      
      return if !Caboose.use_url_params      
      url = "#{request.fullpath}"
      url[0] = "" if url.starts_with?('/')      
      url = url.split('?')[0] if url.include?('?')      
      arr = url.split('/')      
      i = arr.count - 1
      while i >= 1 do
        k = arr[i-1]
        v = arr[i]    
        if v && v.length > 0
          v = v.gsub('%20', ' ')
          params[k] = v
        end
        i = i-2
      end      
    end
    
    # To be overridden by the child controllers
    def before_action      <commit_msg>Push latest for pull<commit_after>module Caboose
  class ApplicationController < ActionController::Base

    protect_from_forgery  
    before_filter :before_before_action
    helper_method :logged_in?
    
    @find_page = true
    
    def before_before_action
      
      # Modify the built-in params array with URL params if necessary
      parse_url_params if Caboose.use_url_params
      
      
      session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
      
      # Initialize AB Testing
      AbTesting.init(request.session_options[:id]) if Caboose.use_ab_testing      
      
      # Try to find the page 
      @page = Page.new
      @crumb_trail  = []
      @subnav       = {}
      @actions      = {}
      @tasks        = {}
      @page_tasks   = {}
      @is_real_page = false
      
      if @find_page
        @page = Page.page_with_uri(request.fullpath)
        @crumb_trail  = Caboose::Page.crumb_trail(@page)		    
      end
      
      # Sets an instance variable of the logged in user
      @logged_in_user = logged_in_user      
      
      before_action
    end
    
    # Parses any parameters in the URL and adds them to the params
    def parse_url_params      
      return if !Caboose.use_url_params      
      url = "#{request.fullpath}"
      url[0] = "" if url.starts_with?('/')      
      url = url.split('?')[0] if url.include?('?')      
      arr = url.split('/')      
      i = arr.count - 1
      while i >= 1 do
        k = arr[i-1]
        v = arr[i]    
        if v && v.length > 0
          v = v.gsub('%20', ' ')
          params[k] = v
        end
        i = i-2
      end      
    end
    
    # To be overridden by the child controllers
    def before_action      
{'fraction_non_alphanumeric': 0.08918296892980437, 'fraction_numerical': 0.005178365937859608, 'mean_word_length': 1.7079439252336448, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6607085', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1094, 'n_words': 268}