public function previousVersion()
{
global $wicked;
$this->version();
$history = $wicked->getHistory($this->pageName());
if (count($history) == 0) {
return null;
}
if ($this->isOld()) {
for ($i = 0; $i < count($history); $i++) {
if ($history[$i]['page_version'] == $this->version()) {
if ($i + 1 < count($history)) {
$i++;
break;
} else {
return null;
}
}
}
if ($i == count($history)) {
return null;
}
} else {
$i = 0;
}
return $history[$i]['page_version'];
}