Use WPPREFIX from environment, use MW API impl from regen.py in stats.py