<?php
if (!defined('IN_SAS'))
{
	die("Hacking attempt");
}

/*
** DGS Search
** stats.php written by James Sella
** Copyright (c) 2000-2001 Digital Genesis Software, LLC. All Rights Reserved.
** Released under the GPL Version 2 License.
** http://www.digitalgenesis.com
*#$Id: stats.php,v 1.1 2006/10/03 08:54:49 fstuurman Exp $
*/

function stats($retVal, $q, $r, $o, $s, $timer)
{
	global $config, $sas_lang;

	$size = ($s < 1) ? count($retVal) : $s;
	$fonts = 'Arial, Sans-Serif, Helvetica';
	$target = '_self';
	$lowerBound = $o +1;
	$upperBound = ($r + $o < $size) ? $o + $r : $size;
	$searchTime = sprintf('%.1f', getTime() - $timer);
	$searchTime = ($searchTime > 0.0) ? $searchTime : 0.1;

	if ($size > 0)
	{
		$sas_lang['search_module_results'] = str_replace('@QUERY@', $q, $sas_lang['search_module_results']);
		$sas_lang['search_module_results'] = str_replace('@SEARCHTIME@', $searchTime, $sas_lang['search_module_results']);
		$sas_lang['search_module_results'] = str_replace('@LOWERBOUND@', $lowerBound, $sas_lang['search_module_results']);
		$sas_lang['search_module_results'] = str_replace('@UPPERBOUND@', $upperBound, $sas_lang['search_module_results']);
		$sas_lang['search_module_results'] = str_replace('@TOTALRESULTS@', $size, $sas_lang['search_module_results']);
		printf("\t<DIV> <!-- Display Module: stats -->\n\t\t<FONT FACE=\"%s\">%s", $fonts, $sas_lang['search_module_results']);
	}
	else
		if (!$q)
		{
			$sas_lang['noQuery'] = str_replace('@QUERY@', $q, $sas_lang['noQuery']);
			$sas_lang['noQuery'] = str_replace('@SEARCHTIME@', $searchTime, $sas_lang['noQuery']);
			printf("\t\t<FONT FACE=\"%s\">%s", $fonts, $sas_lang['noQuery']);
		}
		else
		{
			$sas_lang['search_module_noResults'] = str_replace('@QUERY@', $q, $sas_lang['search_module_noResults']);
			$sas_lang['search_module_noResults'] = str_replace('@SEARCHTIME@', $searchTime, $sas_lang['search_module_noResults']);
			printf("\t\t<FONT FACE=\"%s\">%s", $fonts, $sas_lang['search_module_noResults']);
		}

	printf("\t</FONT>\n\t</DIV>\n");

	return true;
}
?>
