<commit_before><?
/*
Copyright(c)2008 Internet Archive. Software license AGPL version 3.

This file is part of GnuBook.

    GnuBook is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GnuBook is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with GnuBook.  If not, see <http://www.gnu.org/licenses/>.

GnuBookPrint.php exists to get around the same-origin policy that prevents
us from calling print() on an iframe that comes from a cluster datanode.
*/

$id     = $_REQUEST['id'];
$server = $_REQUEST['server'];
$zip    = $_REQUEST['zip'];
$file  = $_REQUEST['file'];
$format = $_REQUEST['format'];
//$imgAspect = $_REQUEST['aspect'];
$width = floatval($_REQUEST['width']);
$height = floatval($_REQUEST['height']);
$title = $_REQUEST['title'];

/* We assume that the print aspect ratio is somewhat close to US Letter in portrait orientation */
$paperAspect = 8.5/11;<commit_msg>Process escaped unicode characters in title<commit_after><?
/*
Copyright(c)2008 Internet Archive. Software license AGPL version 3.

This file is part of GnuBook.

    GnuBook is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GnuBook is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with GnuBook.  If not, see <http://www.gnu.org/licenses/>.

GnuBookPrint.php exists to get around the same-origin policy that prevents
us from calling print() on an iframe that comes from a cluster datanode.
*/

// From http://us2.php.net/manual/en/function.urldecode.php
function utf8_urldecode($str) {
    $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\1;", urldecode($str));
    return html_entity_decode($str,null,'UTF-8');;
}

$id     = $_REQUEST['id'];
$server = $_REQUEST['server'];
$zip    = $_REQUEST['zip'];
$file  = $_REQUEST['file'];
$format = $_REQUEST['format'];
//$imgAspect = $_REQUEST['aspect'];
$width = floatval($_REQUEST['width']);
$height = floatval($_REQUEST['height']);
$title = utf8_urldecode($_REQUEST['title']);

/* We assume that the print aspect ratio is somewhat close to US Letter in portrait orientation */
$paperAspect = 8.5/11;
{'fraction_non_alphanumeric': 0.10671140939597315, 'fraction_numerical': 0.009731543624161074, 'mean_word_length': 4.10445205479452, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '624807', 'n_tokens_mistral': 850, 'n_tokens_neox': 824, 'n_words': 359}