The following lines of LLM’s code:
[?page :block/path-refs ?r1]
...
[?page :block/path-refs ?r2]
…are looking inside the path-refs of ?page itself. Should instead be some blocks of ?page:
[?b1 :block/page ?page]
[?b1 :block/path-refs ?r1]
...
[?b2 :block/page ?page]
[?b2 :block/path-refs ?r2]