protected function limitTableRecords($tableName)
{
$cleanedUp = false;
if (mt_rand(0, mt_getrandmax()) % 5 == 0) {
$this->databaseConnection->sql_query('DELETE FROM ' . $tableName . ' WHERE uid <= (SELECT t2.uid FROM (SELECT uid FROM ' . $tableName . ' ORDER BY uid DESC LIMIT ' . self::$maximumNumberOfRecords . ',1) t2)');
$cleanedUp = $this->databaseConnection->sql_affected_rows() > 0;
}
return $cleanedUp;
}