<?php namespace TightenCo\Jigsaw;

class BasicOutputPathResolver
{
    public function link($path, $name, $type, $page = 1)
    {
        if ($page > 1) {
            return $this->clean('/' . $path . '/' . $page . '/' . $name . '.' . $type);
        }
        return $this->clean('/' . $path . '/' . $name . '.' . $type);
    }

    public function path($path, $name, $type, $page = 1)
    {
        return $this->link($path, $name, $type, $page);
    }

    public function directory($path, $name, $type, $page = 1)
    {
        if ($page > 1) {
            return $this->clean($path . '/' . $page);
        }
        return $this->clean($path);
    }

    private function clean($path)
    {
        return str_replace('//', '/', $path);
    }
}

<?php namespace TightenCo\Jigsaw;

class BasicOutputPathResolver
{
    public function link($path, $name, $type, $page = 1)
    {
        $extension = $type ? '.' . $type : '';
        $name = basename($name, $extension);

        return $page > 1 ?
            $this->clean('/' . $path . '/' . $page . '/' . $name . $extension) :
            $this->clean('/' . $path . '/' . $name . $extension);
    }

    public function path($path, $name, $type, $page = 1)
    {
        return $this->link($path, $name, $type, $page);
    }

    public function directory($path, $name, $type, $page = 1)
    {
        return $page > 1 ?
            $this->clean($path . '/' . $page) :
            $this->clean($path);
    }

    private function clean($path)
    {
        return str_replace('//', '/', $path);
    }
}

Fix double extension bug for nested files with non-pretty-URL
Fix double extension bug for nested files with non-pretty-URL
