protected function _shorten($desired)
    {
        if (
            isset($this->_appScopeTrait) &&
            isset($this->app->max_name_length) &&
            strlen($desired) > $this->app->max_name_length
        ) {

            /*
             * Basic rules: hash is 10 character long (8+2 for separator)
             * We need at least 5 characters on the right side. Total must not exceed
             * max_name_length. First chop will be max-10, then chop size will increase by
             * max-15
             */
            $len = strlen($desired);
            $left = $len - ($len - 10) % ($this->app->max_name_length - 15) - 5;

            $key = substr($desired, 0, $left);
            $rest = substr($desired, $left);

            if (!isset($this->app->unique_hashes[$key])) {
                $this->app->unique_hashes[$key] = '_'.dechex(crc32($key));
            }
            $desired = $this->app->unique_hashes[$key].'__'.$rest;
        }

        return $desired;
    }