public Path cut(int count) {
            requireInRange(count, "cut count", 0, length);
            Node node = head;
            for (int i = 0; i < count; i++)
                node = node.next;

            return new Path(node, length - count, true, validator);
        }
Returns a copy of this where the last segments are cut off, and with a trailing slash.
vespajlib/src/main/java/ai/vespa/http/HttpURL.java