I find that sometimes the lenght of the array in userdata[‘whence’] will less than the maxhence, so I add one more condition checking at line 15:
if(!isset($this->_ci->session->userdata[‘whence’]) || count($this->_ci->session->userdata[‘whence’]) < $this->maxwhence)
{
$this->clearwhence();
}
