<commit_before><?php

$t = $this;   # templater object

#
# Helper Functions
#
function build_page_tab_menu($t) {
  $page_tabs = array(
    'edit' => array('Edit', $t->data('editor')),
    'discuss' => array('Discuss', 'Under development: a comment space'),
    'history' => array('History', 'Under development: list of page edits'),
    'access' => array('Access', 'Under development: page access control form')
  );
  $user_tabs = array(
    'default' => array('edit>hide', 'discuss', 'history'),
    'logged-in' => array('edit', 'discuss', 'history', 'access')
  );

  $tab_format = '<li><a href="#%s" data-toggle="tab">%s</a></li>';
  $panel_format = '<div class="tab-pane" id="%s">%s</div>';

  $tabs = array(
    sprintf('<li class="title active"><a href="#read" data-toggle="tab">%s</a></li>',
      $t->data('page-title'))
  );
  $panels = array(
    '<div class="tab-pane active" id="read"></div>'
  );

  $key = ( User::is_logged_in() ) ? 'logged-in' : 'default';
  $tab_list = $user_tabs[$key];

  foreach ( $tab_list as $tab_key ) {
    if ( strpos($tab_key, '>') !== FALSE ) {
      list($tab_key, $mod) = explode('>', $tab_key);
    }
    else {
      $mod = 'show';
    }

    $tab_data = $page_tabs[$tab_key];

    if ( $mod !== 'hide' ) {
      $tabs[] = sprintf($tab_format, $tab_key, $tab_data[0]);
    }
    $panels[] = sprintf($panel_format, $tab_key, $tab_data[1]);
  }

  return array(
    'tab-list' => implode("\n", $tabs),<commit_msg>Modify history link in page handler view.<commit_after><?php

$t = $this;   # templater object

#
# Helper Functions
#
function build_page_tab_menu($t) {
  $page_tabs = array(
    # key => array(label, link, panel content)
    'edit' => array('Edit', '#edit', $t->data('editor')),
    'discuss' => array('Discuss', '#discuss', 'Under development: a comment space'),
    'history' => array('History', '/?handler=history&page=%s', 'Under development: list of page edits'),
    'access' => array('Access', '#access', 'Under development: page access control form')
  );
  $user_tabs = array(
    'default' => array('edit>hide', 'discuss', 'history'),
    'logged-in' => array('edit', 'discuss', 'history', 'access')
  );

  $tab_format = '<li><a href="%s"%s>%s</a></li>';
  $panel_format = '<div class="tab-pane" id="%s">%s</div>';

  $tabs = array(
    sprintf('<li class="title active"><a href="#read" data-toggle="tab">%s</a></li>',
      $t->data('page-title'))
  );
  $panels = array(
    '<div class="tab-pane active" id="read"></div>'
  );

  $key = ( User::is_logged_in() ) ? 'logged-in' : 'default';
  $tab_list = $user_tabs[$key];

  foreach ( $tab_list as $tab_key ) {
    if ( strpos($tab_key, '>') !== FALSE ) {
      list($tab_key, $mod) = explode('>', $tab_key);
    }
    else {
      $mod = 'show';
    }

    list($tab_label, $tab_link_f, $tab_content) = $page_tabs[$tab_key];

    if ( substr_count($tab_link_f, '%s') > 0 ) {
      $tab_link = sprintf($tab_link_f, $t->request->page);
      $data_toggle = '';
    }
    else {
      $tab_link = $tab_link_f;
      $data_toggle = ' data-toggle="tab"';
    }

    if ( $mod !== 'hide' ) {
      $tabs[] = sprintf($tab_format, $tab_link, $data_toggle, $tab_label);
    }
    $panels[] = sprintf($panel_format, $tab_key, $tab_content);
  }

  return array(
    'tab-list' => implode("\n", $tabs),
{'fraction_non_alphanumeric': 0.2282182695206512, 'fraction_numerical': 0.0009044317154054868, 'mean_word_length': 3.6666666666666665, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 55, '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': '4925724', 'n_tokens_mistral': 1234, 'n_tokens_neox': 1229, 'n_words': 245}