protected function calculatePagination()
    {
        if (empty($this->pagination['array']) && empty($this->pagination['call'])) {
            return;
        }
        if (isset($this->pagination['call'])) {
            $this->pagination['array'] = $this->callFunction($this->pagination['call']);
        }

        $keys = ['toPlaceholder'];
        $pagination = $this->template->getSnippet('pagination', ArrayHelper::diffByKeys($this->pagination, $keys));
        if (!empty($this->pagination['toPlaceholder'])) {
            $this->template->addPlaceholder($this->pagination['toPlaceholder'], $pagination);
            $this->template->cachePlaceholders[$this->pagination['toPlaceholder']] = $pagination;
            return;
        }
        $this->template->addPlaceholder('pagination', $pagination);
    }