<commit_before><?php
	#
	# $Id: missing-category.php,v 1.1.2.48 2006-10-31 13:06:26 dan Exp $
	#
	# Copyright (c) 1998-2006 DVL Software Limited
	#

	require_once($_SERVER['DOCUMENT_ROOT'] . '/../classes/ports.php');

DEFINE('MAX_PAGE_SIZE',     500);
DEFINE('DEFAULT_PAGE_SIZE', 100);

DEFINE('NEXT_PAGE',		'Next');

function freshports_CategoryNextPreviousPage($CategoryName, $PortCount, $PageNo, $PageSize) {

	echo "Result Page:";

	$NumPages = ceil($PortCount / $PageSize);

	for ($i = 1; $i <= $NumPages; $i++) {
		if ($i == $PageNo) {
			echo "&nbsp;<b>$i</b>";
			echo "\n";
		} else {
			echo '&nbsp;<a href="/' . $CategoryName . '/?page=' . $i .  '">' . $i . '</a>';
			echo "\n";
		}
	}

	if ($PageNo == $NumPages) {
		echo '&nbsp; ' . NEXT_PAGE;
	} else {
		echo '&nbsp;<a href="/' . $CategoryName . '/?page=' . ($PageNo + 1) .  '">' . NEXT_PAGE . '</a>';
		echo "\n";
	}
}

function str_is_int($str) {
	$var = intval($str);
	return ($str == $var);
}<commit_msg>Add freshports_CategoryByName() to cater for virtual categories<commit_after><?php
	#
	# $Id: missing-category.php,v 1.1.2.49 2006-11-09 21:48:24 dan Exp $
	#
	# Copyright (c) 1998-2006 DVL Software Limited
	#

	require_once($_SERVER['DOCUMENT_ROOT'] . '/../classes/ports.php');

DEFINE('MAX_PAGE_SIZE',     500);
DEFINE('DEFAULT_PAGE_SIZE', 100);

DEFINE('NEXT_PAGE',		'Next');

function freshports_CategoryNextPreviousPage($CategoryName, $PortCount, $PageNo, $PageSize) {

	echo "Result Page:";

	$NumPages = ceil($PortCount / $PageSize);

	for ($i = 1; $i <= $NumPages; $i++) {
		if ($i == $PageNo) {
			echo "&nbsp;<b>$i</b>";
			echo "\n";
		} else {
			echo '&nbsp;<a href="/' . $CategoryName . '/?page=' . $i .  '">' . $i . '</a>';
			echo "\n";
		}
	}

	if ($PageNo == $NumPages) {
		echo '&nbsp; ' . NEXT_PAGE;
	} else {
		echo '&nbsp;<a href="/' . $CategoryName . '/?page=' . ($PageNo + 1) .  '">' . NEXT_PAGE . '</a>';
		echo "\n";
	}
}

function str_is_int($str) {
	$var = intval($str);
	return ($str == $var);
}

function freshports_CategoryByName($db, $CategoryName, $PageNo = 1, $PageSize = DEFAULT_PAGE_SIZE) {
	require_once($_SERVER['DOCUMENT_ROOT'] . '/../classes/categories.php');
	$category = new Category($db);
	$category->FetchByName($CategoryName);

	freshports_ConditionalGet($category->last_modified);

	freshports_CategoryDisplay($db, $category, $PageNo, $PageSize);
}

{'fraction_non_alphanumeric': 0.22330097087378642, 'fraction_numerical': 0.0299704516673702, 'mean_word_length': 3.8268839103869654, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7650927', 'n_tokens_mistral': 1022, 'n_tokens_neox': 907, 'n_words': 188}