<commit_before>module Doculab
  class DocsController < ApplicationController
    rescue_from Doc::FileNotFound, :with => :handle_file_not_found
    layout :select_layout
    helper TableOfContentsHelper
  
    def index
      find('index')
      render :text => @doc.render, :layout => true
    end
  
    def show
      find(params[:permalink])
      render :text => @doc.render, :layout => true
    end
  
    protected
      def find(permalink)
        @doc = lookup_doc(permalink)
        @page = lookup_page(permalink)
      end
      
      def handle_file_not_found(e)
        @doc = Doc.new(:title => "File Not Found", :content => e.message)
        @page = TableOfContents::Page.new("File Not Found")
        render :text => e.message, :layout => true
      end
      
      def lookup_doc(permalink)
        begin
          Doc.find(permalink)
        rescue Doc::FileNotFound => e
          if permalink == 'index'
            Doc.new(:title => Doculab.title, :permalink => 'index', :content => '')
          else
            raise e
          end
        end
      end
          <commit_msg>Having an index page is now a requirement<commit_after>module Doculab
  class DocsController < ApplicationController
    rescue_from Doc::FileNotFound, :with => :handle_file_not_found
    layout :select_layout
    helper TableOfContentsHelper
  
    def index
      find('index')
      render :text => @doc.render, :layout => true
    end
  
    def show
      find(params[:permalink])
      render :text => @doc.render, :layout => true
    end
  
    protected
      def find(permalink)
        @doc = Doc.find(permalink)
        @page = lookup_page(permalink)
      end
      
      def handle_file_not_found(e)
        @doc = Doc.new(:title => "File Not Found", :content => e.message)
        @page = TableOfContents::Page.new("File Not Found")
        render :text => e.message, :layout => true
      end
      
{'fraction_non_alphanumeric': 0.10375391032325339, 'fraction_numerical': 0.0, 'mean_word_length': 2.2306397306397305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '4900937', 'n_tokens_mistral': 570, 'n_tokens_neox': 571, 'n_words': 144}