<commit_before>module Dugway
  class Application
    def initialize(options={})
      @theme = Theme.new(File.join(Dir.pwd, 'source'), options[:customization] || {})
      @store = Store.new(options[:store] || 'dugway')
      
      I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'data', 'locales', '*.yml').to_s]
      I18n.default_locale = 'en-US'
      I18n.locale = @store.locale
    end
    
    def call(env)
      request = Request.new(env)
      
      if request.image?
        @theme.find_image_by_env(env)
      elsif template = find_template(request)
        [200, { 'Content-Type' => template.content_type }, [template.render(@theme, @store, request)]]
      else
        [404, { 'Content-Type' => 'text/plain' }, ['Page not found']]
      end
    end
    
    private
    
    def find_template(request)
      if template = @theme.find_template_by_request(request)
        template
      elsif page = @store.page(request.permalink)
        Template.new(request.file_name, page['content'])
      else
        nil
      end
    end
  end
end<commit_msg>Clarify that these are custom pages<commit_after>module Dugway
  class Application
    def initialize(options={})
      @theme = Theme.new(File.join(Dir.pwd, 'source'), options[:customization] || {})
      @store = Store.new(options[:store] || 'dugway')
      
      I18n.load_path += Dir[File.join(File.dirname(__FILE__), 'data', 'locales', '*.yml').to_s]
      I18n.default_locale = 'en-US'
      I18n.locale = @store.locale
    end
    
    def call(env)
      request = Request.new(env)
      
      if request.image?
        @theme.find_image_by_env(env)
      elsif template = find_template(request)
        [200, { 'Content-Type' => template.content_type }, [template.render(@theme, @store, request)]]
      else
        [404, { 'Content-Type' => 'text/plain' }, ['Page not found']]
      end
    end
    
    private
    
    def find_template(request)
      if template = @theme.find_template_by_request(request)
        template
      elsif custom_page = @store.page(request.permalink)
        Template.new(request.file_name, custom_page['content'])
      else
        nil
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.13553113553113552, 'fraction_numerical': 0.01098901098901099, 'mean_word_length': 2.581967213114754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4088778', 'n_tokens_mistral': 722, 'n_tokens_neox': 707, 'n_words': 136}