<commit_before>class CorporateInformationPagesController < DocumentsController
  prepend_before_filter :find_organisation

  def show
    @corporate_information_page = @document
    @corporate_information_page.extend(UseSlugAsParam)

    set_slimmer_organisations_header([@corporate_information_page.organisation])
    set_slimmer_page_owner_header(@corporate_information_page.organisation)

    if @organisation.is_a? WorldwideOrganisation
      render 'show_worldwide_organisation'
    else
      render :show
    end
  end

  def find_document_or_edition_for_public
    published_edition = @organisation.corporate_information_pages.published.for_slug!(params[:id])
    return published_edition if published_edition.present? && published_edition.available_in_locale?(I18n.locale)
  end

private

  def find_organisation
    @organisation =
      if params.has_key?(:organisation_id)<commit_msg>Move header creation in CIP frontend controller.<commit_after>class CorporateInformationPagesController < DocumentsController
  prepend_before_filter :find_organisation

  def show
    @corporate_information_page = @document
    @corporate_information_page.extend(UseSlugAsParam)

    if @organisation.is_a? WorldwideOrganisation
      render 'show_worldwide_organisation'
    else
      render :show
    end
  end

  def find_document_or_edition_for_public
    published_edition = @organisation.corporate_information_pages.published.for_slug!(params[:id])
    return published_edition if published_edition.present? && published_edition.available_in_locale?(I18n.locale)
  end

  def set_slimmer_headers_for_document()
    set_slimmer_organisations_header([@organisation])
    set_slimmer_page_owner_header(@organisation)
  end

private

  def find_organisation
    @organisation =
      if params.has_key?(:organisation_id)
{'fraction_non_alphanumeric': 0.06098901098901099, 'fraction_numerical': 0.002197802197802198, 'mean_word_length': 5.719557195571956, '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': '3105579', 'n_tokens_mistral': 558, 'n_tokens_neox': 539, 'n_words': 84}