protected static function removeExpired($type)
    {
        switch ($type) {
            case UVTYPE_CHANGE_PASSWORD:
                $lifetime = USER_CHANGE_PASSWORD_URL_LIFETIME;
                break;
            case UVTYPE_LOGIN_FOREVER:
                $lifetime = USER_FOREVER_COOKIE_LIFETIME;
                break;
            default:
                $lifetime = 5184000; // 60 days
                break;
        }
        $db = Database::connection();
        $db->executeQuery('DELETE FROM UserValidationHashes WHERE type = ? AND uDateGenerated <= ?', array($type, time() - $lifetime));
    }