$time_cutoff_text = sprintf(_("Only proofreader suggestions made <b>after %s</b> are included in the results."), strftime($datetime_format, $timeCutoff));
}
// $format determines what is presented from this page:
//   'html' - page is rendered with frequencies included
//   'file' - all words and frequencies are presented as a
//            downloaded file
// 'update' - update the list
$format = get_enumerated_param($_REQUEST, 'format', 'html', array('html', 'file', 'update'));
if ($format == "update") {
    $postedWords = parse_posted_words($_POST);
    $words = load_project_good_words($projectid);
    $words = array_merge($words, $postedWords);
    save_project_good_words($projectid, $words);
    $format = "html";
}
list($all_suggestions_w_freq, $all_suggestions_w_occurrences, $round_suggestions_w_freq, $round_suggestions_w_occurrences, $rounds, $round_page_count, $messages) = _get_word_list($projectid, $timeCutoff);
$title = _("Candidates for Good Words List from Proofreaders");
$page_text = sprintf(_("Displayed below are the words that proofreaders have suggested (via the %s button) in the WordCheck interface that have not been already included in the project's Good Words List."), "<img src='{$code_url}/graphics/Book-Plus-Small.gif'>");
$page_text .= " ";
$page_text .= _("The results list also shows how many times each word occurs in the project text and how many times each word was suggested by proofreaders.");
if ($format == "file") {
    $filename = "{$projectid}_proofer_suggestions.txt";
    header("Content-type: text/plain");
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    // The cache-control and pragma is a hack for IE not accepting filenames
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    echo $title . "\r\n";
    echo sprintf(_("Project: %s"), get_project_name($projectid)) . "\r\n";
    echo "\r\n";
    echo strip_tags($page_text) . "\r\n";
//   'file' - all words and frequencies are presented as a
//            downloaded file
// 'update' - update the list
$format = get_enumerated_param($_REQUEST, 'format', 'html', array('html', 'file', 'update'));
if ($format == "update") {
    $postedWords = parse_posted_words($_POST);
    $words = load_project_bad_words($projectid);
    $words = array_merge($words, $postedWords);
    save_project_bad_words($projectid, $words);
    $format = "html";
}
$title = _("Candidates for project's Bad Words List from diff analysis");
$page_text = _("Displayed below are words from this project that are likely stealth scannos based on changes proofreaders have made to the project text.");
$page_text .= " ";
$page_text .= _("The results list was generated by comparing the uploaded OCR text and the most recent text of each page. OCRed words that WordCheck would not currently flag, but some instances of which were changed by proofreaders and some instances of which still appear in the project text are included in the results. The results list also shows how often, and how, the word was changed by proofreaders.");
list($percent_changed, $instances_left, $messages, $instances_changed_to, $instances_changed) = _get_word_list($projectid);
if ($format == "file") {
    $filename = "{$projectid}_project_scannos.txt";
    header("Content-type: text/plain");
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    // The cache-control and pragma is a hack for IE not accepting filenames
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    // Process the $instances_[changed_to|changed|left] arrays with the
    // prep_numeric_keys_for_multisort() function to ensure numeric keys
    // are evaluated as strings. This is necessary as the $percent_changed
    // array (iterated over below) has had this function used against it
    // and we use the $percent_changed keys as lookups into the $instances_*
    // arrays.
    prep_numeric_keys_for_multisort($instances_changed_to);
    prep_numeric_keys_for_multisort($instances_changed);
 list($projectname, $projectstate) = $projectdata;
 $goodFileObject = get_project_word_file($projectid, "good");
 // set the timeCutoff
 if ($timeCutoff == -1) {
     $timeCutoffActual = $goodFileObject->mod_time;
 } else {
     $timeCutoffActual = $timeCutoff;
 }
 // load suggestions since cutoff
 $suggestions = load_project_good_word_suggestions($projectid, $timeCutoffActual);
 // if there are no suggestions since the cutoff, skip it
 if (!count($suggestions)) {
     continue;
 }
 // get the data
 list($suggestions_w_freq, $suggestions_w_occurrences, $messages) = _get_word_list($projectid, $suggestions);
 // if no words are returned (probably because something was
 // suggested but is no longer in the text) skip this project
 if (count($suggestions_w_freq) == 0) {
     continue;
 }
 $projectsNeedingAttention++;
 echo "<hr>";
 echo "<h3>{$projectname}</h3>";
 echo "<p><b>" . _("State:") . "</b> {$projectstate}</p>";
 echo_checkbox_selects(count($suggestions_w_freq), $projectid);
 echo_any_warnings_errors($messages);
 $count = 0;
 foreach ($suggestions_w_freq as $word => $freq) {
     $encWord = encode_word($word);
     $context_array[$word] = "<a href='show_good_word_suggestions_detail.php?projectid={$projectid}&amp;word={$encWord}&amp;timeCutoff={$timeCutoffActual}' target='detailframe'>" . _("Context") . "</a>";
$freqCutoff = get_integer_param($_REQUEST, 'freqCutoff', 5, 0, null);
enforce_edit_authorization($projectid);
// $format determins what is presented from this page:
//   'html' - page is rendered with frequencies included
//   'file' - all words and frequencies are presented as a
//            downloaded file
// 'update' - update the list
$format = get_enumerated_param($_REQUEST, 'format', 'html', array('html', 'file', 'update'));
if ($format == "update") {
    $postedWords = parse_posted_words($_POST);
    $words = load_project_bad_words($projectid);
    $words = array_merge($words, $postedWords);
    save_project_bad_words($projectid, $words);
    $format = "html";
}
list($bad_words_w_freq, $messages) = _get_word_list($projectid);
$title = _("Candidates for Bad Words List from Site's Possible bad words file");
$page_text = _("Displayed below are the words from this project that are found in the site's Possible Bad Words files.");
$page_text .= " ";
$page_text = _("The results list was generated by accessing the most recent text of each page and comparing it to the site bad word suggestions file for each of the project's languages and excluding words already on the project's Bad Words List. The results list also shows how many times each word occurs in the project text.");
$page_text2 = _("Words in the Possible Bad Words file are frequently-encountered stealth scannos, and therefore they would not be flagged by the external spell check. The existence of these words in this project does not mean these words are stealth scannos, just that they might be.");
if ($format == "file") {
    $filename = "{$projectid}_possible_bad_words.txt";
    header("Content-type: text/plain");
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    // The cache-control and pragma is a hack for IE not accepting filenames
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    echo $title . "\r\n";
    echo sprintf(_("Project: %s"), get_project_name($projectid)) . "\r\n";
    echo "\r\n";
    $format = "html";
}
$title = _("Ad Hoc Word Details");
$page_text = _("Insert words, one per line, in the box below and click the Show details button to get frequency and context details for them.");
$page_text2 = _("The results list below shows how many times each word occurs in the most recent project text.");
output_header($title, NO_STATSBAR);
echo_page_header($title, $projectid);
echo "<p>{$page_text}</p>";
echo "<form action='show_adhoc_word_details.php' method='post'>";
echo "<input type='hidden' name='projectid' value='{$projectid}'>";
echo "<p><textarea cols='20' rows='6' name='queryWordText'>{$queryWordText}</textarea></p>";
echo "<input type='submit' value='", attr_safe(_("Show details")), "'>";
echo "</form>";
if (count($queryWords)) {
    echo "<hr>";
    list($words_w_freq, $messages) = _get_word_list($projectid, $queryWords);
    // how many instances (ie: frequency sections) are there?
    $instances = 1;
    // what are the cutoff options?
    $cutoffOptions = array(1, 2, 3, 4, 5, 10, 25, 50);
    // what is the intial cutoff frequecny?
    $initialFreq = getInitialCutoff($freqCutoff, $cutoffOptions, $words_w_freq);
    // echo page support text, like JS and stylesheets
    echo_cutoff_script($cutoffOptions, $instances);
    echo_word_freq_style();
    echo_any_warnings_errors($messages);
    echo "<p>" . $page_text2 . "</p>";
    echo_cutoff_text($initialFreq, $cutoffOptions);
    $context_array = build_context_array_links($words_w_freq, $projectid);
    // load the project and site bad words to include in the Notes column
    $site_bad_words = load_site_bad_words_given_project($projectid);