Page MenuHomePhabricator

Display the number of the list entries on special pages with lists
Open, Needs TriagePublic

Description

Motivation
Special pages are super useful for all kinds of analysis and research. For example,

Problem
These pages don’t show how many list entries there are. So in order to obtain this number, all list entries need to be copied from the special page into a spreadsheet. This is cumbersome work, especially when the list entries are stretching across multiple pages, that can probably be avoided.

Wish
Display the number of the list entries on each special page with lists, as this is done with the results on search pages.

Bildschirmfoto 2018-07-13 um 14.46.11.png (158×815 px, 26 KB)

Event Timeline

thiemowmde added subscribers: thiemowmde, Ladsgroup, Addshore.

I kind of remember this request coming up for years, went back and tried to find older tickets asking for the same, but unfortunately found none. The issue is: The queries these special pages execute are expensive. They force you to show the results split over multiple pages with a maximum of 500 rows each for a reason, and that is performance. Counting these results beforehand is similarly expensive as showing all results on one page.

That said, I can think of one way to solve this:

The count must be cached in a way that the expensive query is only executed once a day or so. This means any count shown on these special pages can not be different every time you use the filters on top of the special page in a different way. I mean, we can cache a few different counts depending on the combination of filters. But caching stops making sense when most user will see different numbers.

  • On Special:ListUsers:
    • We need to cache the number of users per group and show it on the top, depending on what group is selected.
    • We might need to cache a second list of numbers that excludes users without edits, and show that if the checkbox is selected.
  • On Special:ListFiles we need two types of numbers:
    • The total number of files is already available at Special:MediaStatistics.
    • If it's worth to cache the number of files per user, I don't know.
  • Special:WhatLinksHere is a bit of a beast, because there are literally millions of numbers to cache, and there are so many combinations of filters (in/excluding transclusions, links, or redirects).

A completely different, much more trivial idea is a JavaScript gadget (possibly similar to my filterContributions) that just counts the elements on the current page, and shows that number somewhere (but does not load following pages).

How many users have a specific user access level (per Wikipedia)?

On the top of Special:ListUsers is a little link (added by the German community) that points to Special:Statistics. This special page shows counts for each user group.

Counting users per access level instead of user group is not easily possible. Special:Listgrouprights lists all the rights that are included in a particular user group. Let's say you want to know how many user are able to upload files. Look for (upload) on Special:Listgrouprights. You will find three groups that are allowed to upload files: "Autoconfirmed users", "Confirmed users", and "Administrators". Since users are typically member of many groups, it would not be correct to add the counts for these groups. The best estimation is probably to just use the biggest number.

Unfortunately, the groups user and autoconfirmed are considered "implicit groups" and not listed on Special:Statistics. It's probably safe to assume that the number of users in these groups is identical to the number of all users.

How many local files does a wiki have?

Special:MediaStatistics.

There is no total number of files on this special page, but it should be fairly easy to calculate.

  • Typically, what we really care about is the number of JPEG files. All kinds of photographs, no matter if done with an actual camera or smartphone, are typically JPEG files.
  • The second category we care about can be calculated by adding up the counts for GIF, PNG, and SVG. These are logos, coats of arms and such.
  • The other types are rare and can be ignored.

How many pages link to a specific page?

Special:WhatLinksHere allows to increase the limit to 5000 – ten times more than available in the interface. A fast way to make use of this hidden feature goes like this:

  • Go to the page you care about, e.g. https://en.wikipedia.org/wiki/Wikipedia.
  • Click "What links here" in the side bar.
  • Look for the line that looks like this: (20 | 50 | 100 | 250 | 500). Click the 50. (Because it's much faster than clicking the 500.)
  • Change the limit=50 in the URL to limit=5000 and press enter.

You can also manually add ?limit=5000 to the original URL, if you feel like it.

For the last page that contains less than 5000 entries, here is a little "Count list entries" bookmarklet you can add to your browsers bookmark bar:

javascript:alert( 'This page contains ' + $( '#mw-content-text ol' ).length + ' ordered and ' + $( '#mw-content-text ul' ).length + ' unordered lists with ' + $( '#mw-content-text li' ).length + ' entries total.' )