protected function buildPage(Page $page, $write=false)
    {
        // Check if we will build this page and report why not.
        // Note: in 2.1 the page filtering API changed, the return value
        // can be a boolean or an array with a boolean + a string.
        if (is_callable($this->filter)) {
            $filterResult = call_user_func($this->filter, $page);
        } else {
            $filterResult = $this->defaultFilter($page);
        }
        if (!is_array($filterResult)) {
            $filterResult = [$filterResult];
        }
        if (A::get($filterResult, 0, false) == false) {
            $log = [
                'type'   => 'page',
                'source' => 'content/'.$page->diruri(),
                'status' => 'ignore',
                'reason' => A::get($filterResult, 1, 'Excluded by filter'),
                'dest'   => null,
                'size'   => null
            ];
            $this->summary[] = $log;
            return;
        }

        // Build the HTML for each language version of the page
        foreach ($this->langs as $lang) {
            $this->buildPageVersion(clone $page, $lang, $write);
        }
    }