<commit_before>require 'iconv'

class HelpController < ApplicationController
  caches_page   :project_css
  theme "rites"
  
  def index
    @help_page_content = current_project.custom_help_page_html
    # Turn untrusted string to UTF-8. We need to do this
    # because for some reason the code being taken is an ascii
    # string being treated as UTF-8.
    # Code taken from http://stackoverflow.com/a/968618
    ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
    @help_page_content = ic.iconv(@help_page_content + ' ')[0..-2]
  end
  
  def preview_help_page
    @help_page_preview_content = params[:preview_help_page_content]
    # Turn untrusted string to UTF-8. We need to do this
    # because for some reason the code being taken is an ascii
    # string being treated as UTF-8.
    # Code taken from http://stackoverflow.com/a/968618
    ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')<commit_msg>Fix chrome error on help page preview<commit_after>require 'iconv'

class HelpController < ApplicationController
  caches_page   :project_css
  theme "rites"
  
  def index
    @help_page_content = current_project.custom_help_page_html
    # Turn untrusted string to UTF-8. We need to do this
    # because for some reason the code being taken is an ascii
    # string being treated as UTF-8.
    # Code taken from http://stackoverflow.com/a/968618
    ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
    @help_page_content = ic.iconv(@help_page_content + ' ')[0..-2]
  end
  
  def preview_help_page
    response.headers["X-XSS-Protection"] = "0"
    @help_page_preview_content = params[:preview_help_page_content]
    # Turn untrusted string to UTF-8. We need to do this
    # because for some reason the code being taken is an ascii
    # string being treated as UTF-8.
    # Code taken from http://stackoverflow.com/a/968618
    ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
{'fraction_non_alphanumeric': 0.09672219236969372, 'fraction_numerical': 0.02418054809242343, 'mean_word_length': 3.34032634032634, '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': '5505727', 'n_tokens_mistral': 640, 'n_tokens_neox': 608, 'n_words': 181}