(response too long, canceling first post)

quick off the top of my head - maybe something like this, though this just returns all of the pages in a given category:

From  includes/specials/SpecialExport.php

function wfExportGetPagesFromCategory( $title ) {
global $wgContLang;

$name = $title->getDBkey();

$dbr = wfGetDB( DB_SLAVE );

list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' );
$sql = "SELECT page_namespace, page_title FROM $page " .
"JOIN $categorylinks ON cl_from = page_id " .
"WHERE cl_to = " . $dbr->addQuotes( $name );

$pages = array();
$res = $dbr->query( $sql, 'wfExportGetPagesFromCategory' );
while ( $row = $dbr->fetchObject( $res ) ) {
$n = $row->page_title;
if ($row->page_namespace) {
$ns = $wgContLang->getNsText( $row->page_namespace );
$n = $ns . ':' . $n;
}

$pages[] = $n;
}
$dbr->freeResult($res);

return $pages;
}