<commit_before>class DocumentsController < ApplicationController
  before_action :authenticate_user!, except: [:show, :analysis]

  # todo Uh, this is a hack. The CSRF token on document editor model to add entities is being rejected... for whatever reason.
  skip_before_action :verify_authenticity_token, only: [:link_entity]

  before_action :set_document, only: [:show, :analysis, :plaintext, :queue_analysis, :edit, :destroy]
  before_action :set_sidenav_expansion
  before_action :set_navbar_color
  before_action :set_navbar_actions, except: [:edit]
  before_action :set_footer_visibility, only: [:edit]

  before_action :cache_linkable_content_for_each_content_type, only: [:edit]

  layout 'editor',    only: [:edit]

  def index
    @page_title = "My documents"
    @documents = current_user.documents.order('updated_at desc')

    if @universe_scope.present?
      @documents = @documents.where(universe_id: @universe_scope.id)
    end
  end

  def show<commit_msg>skip some unneccessary ui code when rendering plaintext documents<commit_after>class DocumentsController < ApplicationController
  before_action :authenticate_user!, except: [:show, :analysis]

  # todo Uh, this is a hack. The CSRF token on document editor model to add entities is being rejected... for whatever reason.
  skip_before_action :verify_authenticity_token, only: [:link_entity]

  before_action :set_document,          only: [:show, :analysis, :plaintext, :queue_analysis, :edit, :destroy]
  before_action :set_sidenav_expansion, except: [:plaintext]
  before_action :set_navbar_color,      except: [:plaintext]
  before_action :set_navbar_actions,    except: [:edit, :plaintext]
  before_action :set_footer_visibility, only: [:edit]

  before_action :cache_linkable_content_for_each_content_type, only: [:edit]

  layout 'editor',    only: [:edit]

  def index
    @page_title = "My documents"
    @documents = current_user.documents.order('updated_at desc')

    if @universe_scope.present?
      @documents = @documents.where(universe_id: @universe_scope.id)
    end
  end

  def show
{'fraction_non_alphanumeric': 0.09542168674698795, 'fraction_numerical': 0.0, 'mean_word_length': 5.197014925373134, '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': '3091263', 'n_tokens_mistral': 674, 'n_tokens_neox': 635, 'n_words': 172}