<commit_before>class SearchController < ApplicationController
  def index
    if params[:search].blank?
      redirect_to region_path(current_region) 
    else
      single_events = SingleEvent.search_in_region(params[:search], current_region)
      @search_result = SearchResult.new(single_events, page)
    end
  end

  private

  def page
    params[:page] || 1
  end
end<commit_msg>Refactor Search Controller<commit_after>class SearchController < ApplicationController
  def index
    redirect_to(region_path(current_region)) && return if params[:search].blank?
    single_events = SingleEvent.search_in_region(params[:search], current_region)
    @search_result = SearchResult.new(single_events, page)
  end

  private

  def page
    params[:page] || 1
  end
end
{'fraction_non_alphanumeric': 0.08333333333333333, 'fraction_numerical': 0.0026041666666666665, 'mean_word_length': 4.532374100719425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2253648', 'n_tokens_mistral': 226, 'n_tokens_neox': 218, 'n_words': 49}