<commit_before>class WebmastersCms::ActiveLanguage < WebmastersCms::ApplicationRecord
  validates :code, uniqueness: true, presence: true

  AVAILABLE_LANGUAGES = ActiveSupport::JSON.decode(File.read(
    ::WebmastersCms::Engine.root.join("config", "languages.json")))

  AVAILABLE_LANGUAGE_SELECT_OPTIONS = AVAILABLE_LANGUAGES.inject({}) do |sum, code_names|
    code, names = code_names
    nativename = names['nativeName']
    name = names['name']
    sum["#{nativename} (#{name})"] = code
    sum
  end

  after_create :create_index_page_if_first_page

  def create_index_page_if_first_page
    Page.create_dummy_page_for_language(code)<commit_msg>  * ActiveLanguage     * call for Page fixed<commit_after>class WebmastersCms::ActiveLanguage < WebmastersCms::ApplicationRecord
  validates :code, uniqueness: true, presence: true

  AVAILABLE_LANGUAGES = ActiveSupport::JSON.decode(File.read(
    ::WebmastersCms::Engine.root.join("config", "languages.json")))

  AVAILABLE_LANGUAGE_SELECT_OPTIONS = AVAILABLE_LANGUAGES.inject({}) do |sum, code_names|
    code, names = code_names
    nativename = names['nativeName']
    name = names['name']
    sum["#{nativename} (#{name})"] = code
    sum
  end

  after_create :create_index_page_if_first_page

  def create_index_page_if_first_page
    WebmastersCms::Page.create_dummy_page_for_language(code)
{'fraction_non_alphanumeric': 0.11259259259259259, 'fraction_numerical': 0.0, 'mean_word_length': 5.8578680203045685, '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': '1074481', 'n_tokens_mistral': 462, 'n_tokens_neox': 448, 'n_words': 74}