change "undefined variable" to a defined one in apckage controller

My IDE complained about "undefined variable $rows" so I changed it to $r.