<commit_before><?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");

#
# Standard Testbed Header
#
PAGEHEADER("Archive Tags");

#
# Only known and logged in users can end experiments.
#
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();

#
# Verify page arguments.
#
$optargs = OptionalPageArguments("index",      PAGEARG_INTEGER,
				 "experiment", PAGEARG_EXPERIMENT,
				 "template",   PAGEARG_TEMPLATE,
				 "instance",   PAGEARG_INSTANCE,
				 "records",    PAGEARG_INTEGER,
				 "tag",        PAGEARG_STRING);

#
# An instance might be a current or historical. If its a template, use
# the underlying experiment of the template.
#
if (isset($instance)) {
    if (($foo = $instance->GetExperiment()))
	$experiment = $foo;
    else
	$index = $instance->exptidx();
    $template = $instance->GetTemplate();
}
elseif (isset($template)) {
    $experiment = $template->GetExperiment();
}
elseif (isset($index)) {
    $experiment = Experiment::Lookup($index);
}

#
# If we got a current experiment, great. Otherwise we have to lookup
# data for a historical experiment.
#
if (isset($experiment) && $experiment) {
    # Need these below.
    $pid = $experiment->pid();
    $eid = $experiment->eid();
    $exptidx = $experiment->idx();

    $stats = $experiment->GetStats();
    if (!$stats) {
	TBERROR("Could not load stats object for experiment $pid/$eid", 1);
    }
    $archive_idx = $stats->archive_idx();

    # Permission
    if (!$isadmin &&
	!$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
	USERERROR("You do not have permission to view tags for ".
		  "archive in $pid/$eid!", 1);
    }
}
elseif (isset($index)) {
    $stats = ExperimentStats::Lookup($index);
    if (!$stats) {
	PAGEARGERROR("Invalid experiment index: $index");
    }

    # Need these below.
    $pid = $stats->pid();
    $eid = $stats->eid();
    $exptidx = $index;
    $archive_idx = $stats->archive_idx();

    # Permission
    if (!$isadmin &&
	!$stats->AccessCheck($this_user, $TB_PROJECT_READINFO)) {
	USERERROR("You do not have permission to view tags for ".
		  "archive in $pid/$eid!", 1);
    }
}
else {
    PAGEARGERROR("Must provide a current or former experiment index");
}

# Show just the last N records unless request is different.
if (!isset($records)) {
    $records = 100;
}

echo "<center>\n";
if ($instance) {
    echo $instance->PageHeader();
    $url = CreateURL("archive_view", $instance);
}
elseif ($template) {
    echo $template->PageHeader();
    $url = CreateURL("archive_view", $template);
}
else {
    echo $stats->PageHeader();
    $url = CreateURL("archive_view", "index", $exptidx);<commit_msg>Quiet a PHP error.<commit_after><?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");

#
# Standard Testbed Header
#
PAGEHEADER("Archive Tags");

#
# Only known and logged in users can end experiments.
#
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();

#
# Verify page arguments.
#
$optargs = OptionalPageArguments("index",      PAGEARG_INTEGER,
				 "experiment", PAGEARG_EXPERIMENT,
				 "template",   PAGEARG_TEMPLATE,
				 "instance",   PAGEARG_INSTANCE,
				 "records",    PAGEARG_INTEGER,
				 "tag",        PAGEARG_STRING);

#
# An instance might be a current or historical. If its a template, use
# the underlying experiment of the template.
#
if (isset($instance)) {
    if (($foo = $instance->GetExperiment()))
	$experiment = $foo;
    else
	$index = $instance->exptidx();
    $template = $instance->GetTemplate();
}
elseif (isset($template)) {
    $experiment = $template->GetExperiment();
}
elseif (isset($index)) {
    $experiment = Experiment::Lookup($index);
}

#
# If we got a current experiment, great. Otherwise we have to lookup
# data for a historical experiment.
#
if (isset($experiment) && $experiment) {
    # Need these below.
    $pid = $experiment->pid();
    $eid = $experiment->eid();
    $exptidx = $experiment->idx();

    $stats = $experiment->GetStats();
    if (!$stats) {
	TBERROR("Could not load stats object for experiment $pid/$eid", 1);
    }
    $archive_idx = $stats->archive_idx();

    # Permission
    if (!$isadmin &&
	!$experiment->AccessCheck($this_user, $TB_EXPT_READINFO)) {
	USERERROR("You do not have permission to view tags for ".
		  "archive in $pid/$eid!", 1);
    }
}
elseif (isset($index)) {
    $stats = ExperimentStats::Lookup($index);
    if (!$stats) {
	PAGEARGERROR("Invalid experiment index: $index");
    }

    # Need these below.
    $pid = $stats->pid();
    $eid = $stats->eid();
    $exptidx = $index;
    $archive_idx = $stats->archive_idx();

    # Permission
    if (!$isadmin &&
	!$stats->AccessCheck($this_user, $TB_PROJECT_READINFO)) {
	USERERROR("You do not have permission to view tags for ".
		  "archive in $pid/$eid!", 1);
    }
}
else {
    PAGEARGERROR("Must provide a current or former experiment index");
}

# Show just the last N records unless request is different.
if (!isset($records)) {
    $records = 100;
}

echo "<center>\n";
if (isset($instance)) {
    echo $instance->PageHeader();
    $url = CreateURL("archive_view", $instance);
}
elseif (isset($template)) {
    echo $template->PageHeader();
    $url = CreateURL("archive_view", $template);
}
else {
    echo $stats->PageHeader();
    $url = CreateURL("archive_view", "index", $exptidx);
{'fraction_non_alphanumeric': 0.1602692377660542, 'fraction_numerical': 0.005457522284882663, 'mean_word_length': 3.7437446074201897, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 41, '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': '5178853', 'n_tokens_mistral': 1857, 'n_tokens_neox': 1778, 'n_words': 478}