protected function processModuleSorting()
    {
        $this->model['is_listified'] = false;
        $this->model['ordered_by']   = [];

        // if there can be only 1 entry, it makes no sense to listify or order in any case
        if ($this->module['max_entries'] == 1) {
            return;
        }

        // if manually sorted, use listify and do not set sorting columns
        if ($this->module['sort_entries_manually']) {
            $this->model['is_listified'] = true;
            return;
        }

        // if automatically sorted, check and extract the sorting columns
        // listify is disabled by default, but may be overridden (might be useful some day)
        $this->model['is_listified'] = false;

        $sorting = trim(strtolower($this->module['sort_entries_by']));

        if (empty($sorting)) return;

        foreach (explode(',', $sorting) as $sortClauseString) {

            if ( ! preg_match("#^\s*[`'](.*)[`']\s+(asc|desc)\s*$#i", $sortClauseString, $matches)) {
                $this->context->log(
                    "Could not interpret sorting clause '{$sortClauseString}' for module #{$this->moduleId}",
                    Generator::LOG_LEVEL_ERROR
                );
                continue;
            }

            // store direction per column as key
            $this->model['ordered_by'][ $matches[1] ] = $matches[2];
        }
    }