<commit_before>class NotificationsController < ::ApplicationController
  before_filter :require_login, except: [:click, :read, :view, :unsubscribe]
  before_filter :require_notification, except: [:click, :read, :view, :unsubscribe]
  before_filter :require_trackable, only: [:click, :read, :view, :unsubscribe]

  include NotificationsHelper

  helper_method :notification

  layout false

  def recent
    respond_to do |format|
      format.json { render json: recent_notifications.to_json }
    end
  end

  def view
    respond_to do |format|
      format.html { render text: trackable.email_html }
      format.text { render text: trackable.email_text }
    end
  end

  def click
    trackable.click

    # To prevent a bare redirect, validate that the redirect url
    # was generated when the email was sent
    target_url = params[:r]
    target_url = root_url if trackable.email_urls.blank? || !trackable.email_urls.split("\n").index(target_url)
<commit_msg>Rename before_filter to before_action for Rails 5.x<commit_after>class NotificationsController < ::ApplicationController
  before_action :require_login, except: [:click, :read, :view, :unsubscribe]
  before_action :require_notification, except: [:click, :read, :view, :unsubscribe]
  before_action :require_trackable, only: [:click, :read, :view, :unsubscribe]

  include NotificationsHelper

  helper_method :notification

  layout false

  def recent
    respond_to do |format|
      format.json { render json: recent_notifications.to_json }
    end
  end

  def view
    respond_to do |format|
      format.html { render text: trackable.email_html }
      format.text { render text: trackable.email_text }
    end
  end

  def click
    trackable.click

    # To prevent a bare redirect, validate that the redirect url
    # was generated when the email was sent
    target_url = params[:r]
    target_url = root_url if trackable.email_urls.blank? || !trackable.email_urls.split("\n").index(target_url)

{'fraction_non_alphanumeric': 0.08865248226950355, 'fraction_numerical': 0.0005065856129685917, 'mean_word_length': 4.064102564102564, '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': '7663160', 'n_tokens_mistral': 596, 'n_tokens_neox': 583, 'n_words': 172}