<commit_before>module UsersHelper

  # Construct table rows for multiple users
  def construct_table_rows(users)
    result = {}
    users.each do |user|
      result[user.id] = construct_table_row(user)
    end
    return result
  end
  
  # Construct a single table row
  def construct_table_row(user) 
    result = {}
    result[:id] = user.id
    result[:user_name] = user.user_name
    result[:first_name] = user.first_name
    result[:last_name] = user.last_name
    result[:hidden] = user.hidden
    result[:edit] = render_to_string :partial => "users/table_row/edit", :locals => {:user => user, :controller => self.controller_name}
    return result
  end

end
<commit_msg>Fixed XSS Vulnerability (ref #231)<commit_after>module UsersHelper

  # Construct table rows for multiple users
  def construct_table_rows(users)
    result = {}
    users.each do |user|
      result[user.id] = construct_table_row(user)
    end
    return result
  end
  
  # Construct a single table row
  def construct_table_row(user) 
    result = {}
    result[:id] = user.id
    result[:user_name] = CGI.escapeHTML(user.user_name)
    result[:first_name] = CGI.escapeHTML(user.first_name)
    result[:last_name] = CGI.escapeHTML(user.last_name)
    result[:hidden] = user.hidden
    result[:edit] = render_to_string :partial => "users/table_row/edit", :locals => {:user => user, :controller => self.controller_name}
    return result
  end

end

{'fraction_non_alphanumeric': 0.11180992313067785, 'fraction_numerical': 0.0020964360587002098, 'mean_word_length': 3.6493506493506493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '212128', 'n_tokens_mistral': 467, 'n_tokens_neox': 456, 'n_words': 106}