Skip to content

Different Location for "Download Statistics"#256

Open
JohannesSeikowsky wants to merge 2 commits intodevfrom
JohannesSeikowsky-patch-8
Open

Different Location for "Download Statistics"#256
JohannesSeikowsky wants to merge 2 commits intodevfrom
JohannesSeikowsky-patch-8

Conversation

@JohannesSeikowsky
Copy link
Contributor

@JohannesSeikowsky JohannesSeikowsky commented Feb 17, 2026

Work on Issue: #255

Moves the Download Statistics and the explanation text and the pretty pictures link to the bottom.

An alternative would be to move the Download statistics onto "pretty pages" and make "pretty pages" our real "Statistics page" (maybe call it that too) and link to it from "Help pages" or so. Maybe in another PR.

For now I think it's important to get the Download statics away from a place where they're distracting users from the main purpose of using the site (i.e. helping people find books they like)

@JohannesSeikowsky JohannesSeikowsky changed the title Update make-topten.php Different Location for "Download Statistics" Feb 17, 2026
@eshellman
Copy link
Collaborator

An alternative would be to move the Download statistics onto "pretty pages" and make "pretty pages" our real "Statistics page" (maybe call it that too) and link to it from "Help pages" or so. Maybe in another PR.

I like that idea.

People will complain if we move the statistics to the bottom; there are people who look at it every day. So lets do it in one step.

The big problem, though is that this page is hard to test; I would need to spend a fair amount of time setting up a proper php dev environment; and we have no real way to run it on dev before pushing to prod. Perhaps @rtonsing can take a look?

@JohannesSeikowsky
Copy link
Contributor Author

do we have a way of getting the "Download statistics" data onto the "pretty pictures" site?

The place where the Download statistics are currently displayed is just not the right place for them (normal users expect to see the top books when clicking the "Frequently Downloaded" link in the header, not statics as the first thing)

@rtonsing
Copy link
Contributor

We have existing test directories at pglaf.org /home/htdocs/dev and dev2, accessed at https://dev.pglaf.org/, or dev2.
php is supported. Will that work?

@eshellman
Copy link
Collaborator

and there's a copy of the db running there, yes?

@JohannesSeikowsky
Copy link
Contributor Author

if we manage to move the "Download Statistics" to pretty pictures, the change in make-topten.php actually seems very straightforward to me. I think all we'd have to do is shorten one string to take the relevant parts out.

@rtonsing
Copy link
Contributor

No, the testing I've done was to the live DB. Which I wanted.

@JohannesSeikowsky
Copy link
Contributor Author

JohannesSeikowsky commented Feb 19, 2026

I've just adjusted this PR to be the simplest possible change. It's obviously better to test in a perfect dev environment, but as far as changes go this is a very straightforward one. maybe just test as @rtonsing suggests and deploy.

What we still need is a way of moving the "Download statistics" data to pretty pictures ... any ideas?

@JohannesSeikowsky
Copy link
Contributor Author

JohannesSeikowsky commented Feb 19, 2026

This is how the page will look like without the statistics. much better/cleaner. How it should be really.
Screenshot_2026-02-19_15-26-58

@JohannesSeikowsky
Copy link
Contributor Author

JohannesSeikowsky commented Feb 19, 2026

I don't understand the php parts of the code very well, but here is one suggestion from Claude Code after some back-and-forth for how to move the Download statistics to pretty pages:

  1. In make-topten.php, after computing $d1, $d7, $d30, write a file "browse/scores/stats-table.html" containing just the rendered HTML (same table that's currently on the top pages).
  2. In pretty-pictures.md, add a
    and a small <script> that does fetch('/browse/scores/stats-table.html') and puts the result into that div's innerHTML.
  3. Remove the table block from the $s heredoc in make-topten.php.
  4. Test by running make-topten.php locally and checking that stats-table.html is written, then verifying it renders on pretty-pictures.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants